Download Fore_End/cpcn2/node_modules/duplexer/test/index.js from zxy0307/JavaWeb: direct link, hf CLI and curl.
- Browser
- Download file 525 Bytes
-
https://huggingface.co/zxy0307/JavaWeb/resolve/main/Fore_End/cpcn2/node_modules/duplexer/test/index.js
- Command line
-
hf download hf://zxy0307/JavaWeb/Fore_End/cpcn2/node_modules/duplexer/test/index.js
-
curl -L -o index.js https://huggingface.co/zxy0307/JavaWeb/resolve/main/Fore_End/cpcn2/node_modules/duplexer/test/index.js
525 Bytes
| var through = require("through") | |
| var test = require("tape") | |
| var duplex = require("../index") | |
| var readable = through() | |
| var writable = through(write) | |
| var written = 0 | |
| var data = 0 | |
| var stream = duplex(writable, readable) | |
| function write() { | |
| written++ | |
| } | |
| stream.on("data", ondata) | |
| function ondata() { | |
| data++ | |
| } | |
| test("emit and write", function(t) { | |
| t.plan(2) | |
| stream.write() | |
| readable.emit("data") | |
| t.equal(written, 1, "should have written once") | |
| t.equal(data, 1, "should have received once") | |
| }) | |