Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accum

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accum - npm Package Compare versions

Comparing version 0.3.6 to 0.3.7

2

package.json
{
"name": "accum",
"description": "accum - Simple write stream which accumulates or collects the data from a stream. Pipe your stream into this to get all the data as buffer, string, or raw array. (streams2)",
"version": "0.3.6",
"version": "0.3.7",
"author": "Jeff Barczewski <jeff.barczewski@gmail.com>",

@@ -6,0 +6,0 @@ "repository": {

@@ -18,3 +18,3 @@ # accum

- The default automatic method - `accum([options], listenerFn)` constructs a write stream which checks if the first chunk is a Buffer and if so returns a concatenated Buffer of all the data, otherwise if it is a string then returns a concatenated string, otherwise returns a raw array. The `listenerFn` signature is `function(alldata)`. The `listenerFn` is called after all the data is received just prior to the `end` event being emitted. The `options` parameter can be omitted.
- The default automatic method - `accum([options], listenerFn)` constructs a write stream which checks if the first chunk is a Buffer and if so returns a concatenated Buffer of all the data, otherwise if it is a string then returns a concatenated string, otherwise returns a raw array. The `listenerFn` signature is `function(alldata)`. The `listenerFn` is called after all the data is received just prior to the `end` event being emitted. The `options` parameter is passed to the underlying writable stream constructor (see [Node.js stream docs](https://nodejs.org/dist/latest-v7.x/docs/api/stream.html#stream_constructor_new_stream_writable_options). The `options` parameter can be omitted.

@@ -31,3 +31,3 @@ ```javascript

- `accum.buffer([options], listenerFn)` - constructs a write stream which converts everything into a Buffer, concatenates, and calls the `listenerFn` with the buffer. The `listenerFn` signature is `function(buffer)`. The `listenerFn` is called after all the data is received just prior to the `end` event being emitted. The `options` parameter can be omitted.
- `accum.buffer([options], listenerFn)` - constructs a write stream which converts everything into a Buffer, concatenates, and calls the `listenerFn` with the buffer. The `listenerFn` signature is `function(buffer)`. The `listenerFn` is called after all the data is received just prior to the `end` event being emitted. The `options` parameter is passed to the underlying writable stream constructor (see [Node.js stream docs](https://nodejs.org/dist/latest-v7.x/docs/api/stream.html#stream_constructor_new_stream_writable_options). The `options` parameter can be omitted.

@@ -42,3 +42,3 @@ ```javascript

- `accum.string([options], listenerFn)` - constructs a write stream which concatenates everything into a string. Buffer data is converted to string using the optional `encoding` which defaults to 'utf8'. Other data is simply converted using `.toString()`. The `listenerFn` signature is `function(string)`. The `listenerFn` is called after all the data is received just prior to the `end` event being emitted. The `options` parameter can be omitted.
- `accum.string([options], listenerFn)` - constructs a write stream which concatenates everything into a string. Buffer data is converted to string using the optional `encoding` which defaults to 'utf8'. Other data is simply converted using `.toString()`. The `listenerFn` signature is `function(string)`. The `listenerFn` is called after all the data is received just prior to the `end` event being emitted. The `options` parameter is passed to the underlying writable stream constructor (see [Node.js stream docs](https://nodejs.org/dist/latest-v7.x/docs/api/stream.html#stream_constructor_new_stream_writable_options). The `options` parameter can be omitted.

@@ -53,3 +53,3 @@ ```javascript

- `accum.array([options], listenerFn)` - constructs a write stream which concatenates everything into an array without any conversion, which the `listenerFn` receives the accumulated data on end. The `listenerFn` signature is `function(arr)`. The `listenerFn` is called after all the data is received just prior to the `end` event being emitted. The `options` parameter can be omitted.
- `accum.array([options], listenerFn)` - constructs a write stream which concatenates everything into an array without any conversion, which the `listenerFn` receives the accumulated data on end. The `listenerFn` signature is `function(arr)`. The `listenerFn` is called after all the data is received just prior to the `end` event being emitted. The `options` parameter is passed to the underlying writable stream constructor (see [Node.js stream docs](https://nodejs.org/dist/latest-v7.x/docs/api/stream.html#stream_constructor_new_stream_writable_options). The `options` parameter can be omitted.

@@ -64,2 +64,13 @@ ```javascript

If you are intending to use an object stream, then you will want to set the `options` to `{objectMode: true}`
```javascript
var accum = require('accum');
rstream
.pipe(accum.array({ objectMode: true }, function (array) {
// use the accumulated data - array of objects
}));
```
### Error handling

@@ -86,2 +97,3 @@

- Tested with binary data
- Handle multibyte utf8 data which may have gotten split across packets in a stream

@@ -92,4 +104,5 @@ ## Why

There were several existing projects that also accumululate in slightly different ways:
Other projects that also accumululate in slightly different ways:
- https://github.com/maxogden/concat-stream
- https://github.com/polotek/data-collector-stream

@@ -103,2 +116,6 @@ - https://github.com/Weltschmerz/Accumulate

- 0.11
- 0.12
- 4.x
- 6.x
- 7.x

@@ -116,2 +133,1 @@ ## Get involved

- [MIT license](http://github.com/jeffbski/accum/raw/master/LICENSE)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc