Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when concatenating two streams #3

Closed
coyotte508 opened this issue Nov 29, 2017 · 3 comments
Closed

Error when concatenating two streams #3

coyotte508 opened this issue Nov 29, 2017 · 3 comments

Comments

@coyotte508
Copy link

var fs = require("fs");
var StreamConcat = require("stream-concat");

var in1 = fs.createReadStream("a.jpg");
var in2 = fs.createReadStream("b.jpg");

StreamConcat([in1, in2]);

I get:

TypeError: dest.on is not a function
    at ReadStream.Readable.pipe (_stream_readable.js:582:8)
    at nextStream (/mnt/c/Users/coyot/code/.../node_modules/stream-concat/index.js:26:26)
    at StreamConcat (/mnt/c/Users/coyot/code/.../node_modules/stream-concat/index.js:31:3)
    at repl:1:1
    at ContextifyScript.Script.runInThisContext (vm.js:50:33)
    at REPLServer.defaultEval (repl.js:240:29)
    at bound (domain.js:301:14)
    at REPLServer.runBound [as eval] (domain.js:314:12)
    at REPLServer.onLine (repl.js:441:10)
    at emitOne (events.js:121:20)

I use node 9.2.

@sedenardi
Copy link
Owner

Hi there, sorry to hear you're having issues.

Without seeing all of your code, first thing I'd do is make sure you're using StreamConcat with the new keyword.

var fs = require("fs");
var StreamConcat = require("stream-concat");

var in1 = fs.createReadStream("a.jpg");
var in2 = fs.createReadStream("b.jpg");

var out = new StreamConcat([in1, in2]);

Additionally, I've just updated the project with some tests that may be of use. Let me know if you're still having troubles.

@coyotte508
Copy link
Author

coyotte508 commented Nov 30, 2017

Right, that may be it. I went through the trouble of updating the code to ES6 and it worked - but probably because my compiler forced me to add the new keyword.

Thank you for your prompt response :)

@sedenardi
Copy link
Owner

Great, glad to hear you got it working.

I'll eventually release an ES6 class version as 2.0.0, but for now, it works well on all node versions, so I'm fine leaving it as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants