diff --git a/README.md b/README.md index 00c1b3f..426ab3c 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,11 @@ stream = new BufferStream([{encoding:'utf8', size:'none'}]) // default ``` * `encoding` default encoding for writing strings * `size` defines buffer level or sets buffer to given size (see ↓`setSize` for more) + * `split` short form for: + +```javascript +stream.split(token, function (chunk) {stream.emit('data', chunk)}) +``` ### stream.setSize diff --git a/package.json b/package.json index ece5392..0866084 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bufferstream" , "description": "painless stream buffering and cutting" -, "version": "0.4.6" +, "version": "0.4.7" , "homepage": "https://github.com/dodo/node-bufferstream" , "author": "dodo (https://github.com/dodo)" , "repository": {"type": "git", "url": "git://github.com/dodo/node-bufferstream.git"} diff --git a/src/buffer-stream.coffee b/src/buffer-stream.coffee index 13c3632..064c541 100644 --- a/src/buffer-stream.coffee +++ b/src/buffer-stream.coffee @@ -47,6 +47,7 @@ class BufferStream extends Stream @__defineGetter__ 'length', () => @buffer.length # init @reset() + @split opts.split, ((data) -> @emit('data', data)) if opts.split? super getBuffer: () => @buffer