File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ require('../reader').decorate(streams.ReadableStream.prototype);
99require ( '../writer' ) . decorate ( streams . WritableStream . prototype ) ;
1010
1111function fixOptions ( options ) {
12+ if ( typeof options === "string" ) options = {
13+ encoding : options ,
14+ } ;
1215 options = options || { } ;
1316 options . ez = true ;
1417 return options ;
@@ -25,7 +28,10 @@ module.exports = {
2528 /// For a full description of the options, see `ReadableStream` in
2629 /// https://github.com/Sage/streamline-streams/blob/master/lib/streams.md
2730 reader : function ( emitter , options ) {
28- return new streams . ReadableStream ( emitter , fixOptions ( options ) ) ;
31+ options = fixOptions ( options ) ;
32+ var reader = new streams . ReadableStream ( emitter , options ) ;
33+ if ( options . encoding ) reader . setEncoding ( options . encoding ) ;
34+ return reader ;
2935 } ,
3036 /// * `writer = ez.devices.node.writer(stream, options)`
3137 /// wraps a node.js stream as an EZ writer.
You can’t perform that action at this time.
0 commit comments