ArtskydJ / node-sox-stream

:mega: A stream-friendly wrapper around SoX
53 stars 14 forks source link

Problem with returning the object from require #2

Closed CliffS closed 9 years ago

CliffS commented 9 years ago

In order to convert a bunch of objects, a paradigm like

SoX = require('sox-stream');
sox = new SoX(input_options, output_options, file);

where sox is a duplex stream.

Otherwise multiple calls to require('sox-stream'); are going to return the same stream.

ArtskydJ commented 9 years ago

require('sox-stream') does not return a stream; it returns a constructor to make a stream.

Your example above should work.

CliffS commented 9 years ago

Ah, sorry, I must have misread the documentation. I didn't spot any reference to new.

ArtskydJ commented 9 years ago

That's fine. There aren't any references to new, because I am using a closure rather than a prototype.

If you want you can use new with sox-stream.

var Sox = require('sox-stream')

var sox = new Sox({ ... })

I think the documentation should be a bit clearer on how to construct the stream.

I'll leave this issue open until I fix the docs.