aboutsummaryrefslogtreecommitdiff
path: root/node_modules/stream-to-array
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/stream-to-array')
-rw-r--r--node_modules/stream-to-array/README.md80
-rw-r--r--node_modules/stream-to-array/index.js60
-rw-r--r--node_modules/stream-to-array/package.json36
3 files changed, 0 insertions, 176 deletions
diff --git a/node_modules/stream-to-array/README.md b/node_modules/stream-to-array/README.md
deleted file mode 100644
index 0af44eb86..000000000
--- a/node_modules/stream-to-array/README.md
+++ /dev/null
@@ -1,80 +0,0 @@
-# Stream to Array
-
-[![NPM version][npm-image]][npm-url]
-[![Build status][travis-image]][travis-url]
-[![Test coverage][coveralls-image]][coveralls-url]
-[![Dependency Status][david-image]][david-url]
-[![License][license-image]][license-url]
-[![Downloads][downloads-image]][downloads-url]
-
-Concatenate a readable stream's data into a single array.
-
-You may also be interested in:
-
-- [raw-body](https://github.com/stream-utils/raw-body) for strings
-
-## API
-
-```js
-var toArray = require('stream-to-array')
-```
-
-### toArray([stream], [callback(err, arr)])
-
-Returns all the data objects in an array.
-This is useful for streams in object mode if you want to just use an array.
-
-```js
-var stream = new Stream.Readable()
-toArray(stream, function (err, arr) {
- assert.ok(Array.isArray(arr))
-})
-```
-
-If `stream` is not defined, it is assumed that `this` is a stream.
-
-```js
-var stream = new Stream.Readable()
-stream.toArray = toArray
-stream.toArray(function (err, arr) {
-
-})
-```
-
-If `callback` is not defined, then it returns a promise.
-
-```js
-toArray(stream)
- .then(function (parts) {
-
- })
-```
-
-If you want to return a buffer, just use `Buffer.concat(arr)`
-
-```js
-toArray(stream)
- .then(function (parts) {
- var buffers = []
- for (var i = 0, l = parts.length; i < l ; ++i) {
- var part = parts[i]
- buffers.push((part instanceof Buffer) ? part : new Buffer(part))
- }
- return Buffer.concat(buffers)
- })
-```
-
-[npm-image]: https://img.shields.io/npm/v/stream-to-array.svg?style=flat-square
-[npm-url]: https://npmjs.org/package/stream-to-array
-[github-tag]: http://img.shields.io/github/tag/stream-utils/stream-to-array.svg?style=flat-square
-[github-url]: https://github.com/stream-utils/stream-to-array/tags
-[travis-image]: https://img.shields.io/travis/stream-utils/stream-to-array.svg?style=flat-square
-[travis-url]: https://travis-ci.org/stream-utils/stream-to-array
-[coveralls-image]: https://img.shields.io/coveralls/stream-utils/stream-to-array.svg?style=flat-square
-[coveralls-url]: https://coveralls.io/r/stream-utils/stream-to-array?branch=master
-[david-image]: http://img.shields.io/david/stream-utils/stream-to-array.svg?style=flat-square
-[david-url]: https://david-dm.org/stream-utils/stream-to-array
-[license-image]: http://img.shields.io/npm/l/stream-to-array.svg?style=flat-square
-[license-url]: LICENSE
-[downloads-image]: http://img.shields.io/npm/dm/stream-to-array.svg?style=flat-square
-[downloads-url]: https://npmjs.org/package/stream-to-array
diff --git a/node_modules/stream-to-array/index.js b/node_modules/stream-to-array/index.js
deleted file mode 100644
index 2d6aaa0fb..000000000
--- a/node_modules/stream-to-array/index.js
+++ /dev/null
@@ -1,60 +0,0 @@
-
-var Promise = require('any-promise')
-
-module.exports = function (stream, done) {
- if (!stream) {
- // no arguments, meaning stream = this
- stream = this
- } else if (typeof stream === 'function') {
- // stream = this, callback passed
- done = stream
- stream = this
- }
-
- var deferred
- if (!stream.readable) deferred = Promise.resolve([])
- else deferred = new Promise(function (resolve, reject) {
- // stream is already ended
- if (!stream.readable) return resolve([])
-
- var arr = []
-
- stream.on('data', onData)
- stream.on('end', onEnd)
- stream.on('error', onEnd)
- stream.on('close', onClose)
-
- function onData(doc) {
- arr.push(doc)
- }
-
- function onEnd(err) {
- if (err) reject(err)
- else resolve(arr)
- cleanup()
- }
-
- function onClose() {
- resolve(arr)
- cleanup()
- }
-
- function cleanup() {
- arr = null
- stream.removeListener('data', onData)
- stream.removeListener('end', onEnd)
- stream.removeListener('error', onEnd)
- stream.removeListener('close', onClose)
- }
- })
-
- if (typeof done === 'function') {
- deferred.then(function (arr) {
- process.nextTick(function() {
- done(null, arr)
- })
- }, done)
- }
-
- return deferred
-}
diff --git a/node_modules/stream-to-array/package.json b/node_modules/stream-to-array/package.json
deleted file mode 100644
index 67e7b3df5..000000000
--- a/node_modules/stream-to-array/package.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "name": "stream-to-array",
- "description": "Concatenate a readable stream's data into a single array",
- "version": "2.3.0",
- "author": {
- "name": "Jonathan Ong",
- "email": "me@jongleberry.com",
- "url": "http://jongleberry.com",
- "twitter": "https://twitter.com/jongleberry"
- },
- "license": "MIT",
- "repository": "stream-utils/stream-to-array",
- "dependencies": {
- "any-promise": "^1.1.0"
- },
- "devDependencies": {
- "bluebird": "^3.1.1",
- "istanbul": "^0.4.2",
- "mocha": "^2.3.3"
- },
- "scripts": {
- "test": "mocha --reporter spec --bail",
- "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
- "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
- },
- "files": [
- "index.js"
- ],
- "keywords": [
- "stream",
- "streams",
- "buffer",
- "array",
- "concat"
- ]
-}