Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Like string_decoder but for streaming arrays
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
.travis.yml
README.md Add travis badge
array_decoder.js No need to store format
package.json

README.md

Build Status

Array Decoder

This class can be used to stream arrays of data when chunks may end with partial elements. Similar to string decoder but for arrays.

Installation

npm install array_decoder

Usage

var ArrayDecoder = require('array_decoder').ArrayDecoder

var decoder = new ArrayDecoder

// Outputs: ['abc', 'def']
console.log(decoder.write(['abc', 'def', 'gh']))

// Outputs: ['ghi', 'jkl']
console.log(decoder.write(['i', 'jkl', 'mn']))

// Outputs: ['mnl']
console.log(decoder.write(['l'], true))

new ArrayDecoder([format])

Output can be string or buffer. If not specified it will be same as input.

write(array, complete)

array - Array of strings, buffers or array of arrays of string or buffers.

complete - Set to true for last chunk.

Something went wrong with that request. Please try again.