stream of split strings
Installation
$ npm install split-stream
Usage
var fs = splitStream = ss = splitStream; fs;
stream2
var fs = splitStream = SplitStream2 ss = splitStream; ss;ss; fs;
old-style stream
var fs = splitStream = SplitStream1 ss = splitStream; ss; ss;ss;ss; fs;
Class
SplitStream
class of SplitStream1 or SplitStream2.
var splitStream = ; // true if over version 0.9.splitStream === splitStreamSplitStream2; // true if over version 0.8.splitStream === splitStreamSplitStream2;
SplitStream2
inherited stream2 class.
Function (SplitStream2)
create(options)
-
`` object - options object
-
return
SplitStream2 - SplitStream2
throw TypeError if options.splitStr is not string or regexp types.
objectMode and decodeStrings are always true.
options
splitStr
string or regexp - split string
default value is /\r?\n/
.
encoding
string - encoding
default value is utf8
. this value is argument of string_decoder.
SplitStream1
inherited old-style stream class.
Function (SplitStream1)
create(options)
-
options
object - option object -
return
SplitStream1 - SplitStream1
throw TypeError if options.splitStr is not string or regexp types.
options
splitStr
string or regexp - split string
default value is /\r?\n/
.
Events (SplitStream1)
close
called destroy().
data
data
string - split string
until buffer is empty.
drain
when buffer is empty.
end
call after end() and when buffer is empty.
error
error
Error - error object
call twice destory() or call write() after end().
Test
$ npm install$ npm test
License
The MIT License. Please see LICENSE file.