Launch Week Day 3: Introducing Organization Notifications in Socket.Learn More
Socket
Book a DemoSign in
Socket

bufferstream

Package Overview
Dependencies
Maintainers
0
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bufferstream - npm Package Compare versions

Comparing version
0.2.0
to
0.3.0
+2
postbuffer.js
module.exports = require('./build/default/post-buffer')
BufferStream = require('./buffer-stream')
class PostBuffer
constructor: (req) ->
@callback = null
@got_all_data = no
@stream = new BufferStream()
req.pipe(@stream)
req.on 'end', =>
@got_all_data = yes
@callback?(@stream.buffer)
onEnd: (callback) =>
@callback = callback
@callback(@stream.buffer) if @got_all_data
# exports
module.exports = PostBuffer
+1
-1
{ "name": "bufferstream"
, "description": "painless stream buffering and cutting"
, "version": "0.2.0"
, "version": "0.3.0"
, "homepage": "https://github.com/dodo/node-bufferstream"

@@ -5,0 +5,0 @@ , "author": "dodo (https://github.com/dodo)"

@@ -17,2 +17,3 @@ # BufferStream

BufferStream = require('bufferstream')
stream = new BufferStream([encoding])

@@ -80,2 +81,18 @@ * `encoding` default encoding for writing strings

### PostBuffer
PostBuffer = require('bufferstream/postbuffer')
post = new PostBuffer(req)
* `req` http.ServerRequest
for if you want to get all the post data from a http server request and do some db reqeust before.
buffer http client
### post.onEnd
post.onEnd(function (data) {…});
set a callback to get all post data from a http server request
## example

@@ -99,1 +116,2 @@

* https://github.com/dodo/node-bufferstream/blob/master/example/split.js