Skip to content

Commit

Permalink
feature request from issue #4: split shortcut option in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
dodo committed Sep 21, 2011
1 parent f646c02 commit c7360ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"}
Expand Down
1 change: 1 addition & 0 deletions src/buffer-stream.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c7360ea

Please sign in to comment.