![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/vreg/node_modules/duplexer/test/ |
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") })