This commit is contained in:
hatuhn
2019-09-13 09:45:04 +07:00
parent f14a34ba19
commit 558fb07261
16790 changed files with 0 additions and 1642370 deletions

22
node_modules/stream-to-array/LICENSE generated vendored
View File

@@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -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

View File

@@ -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
}

View File

@@ -1,67 +0,0 @@
{
"_from": "stream-to-array@^2.3.0",
"_id": "stream-to-array@2.3.0",
"_inBundle": false,
"_integrity": "sha1-u/azn19D7DC8cbq8s3VXrOzzQ1M=",
"_location": "/stream-to-array",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "stream-to-array@^2.3.0",
"name": "stream-to-array",
"escapedName": "stream-to-array",
"rawSpec": "^2.3.0",
"saveSpec": null,
"fetchSpec": "^2.3.0"
},
"_requiredBy": [
"/gulp-inject"
],
"_resolved": "https://registry.npmjs.org/stream-to-array/-/stream-to-array-2.3.0.tgz",
"_shasum": "bbf6b39f5f43ec30bc71babcb37557acecf34353",
"_spec": "stream-to-array@^2.3.0",
"_where": "/Applications/XAMPP/xamppfiles/htdocs/wordpress/t-latehome/wp-content/plugins/opal-estate-pro/node_modules/gulp-inject",
"author": {
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
},
"bugs": {
"url": "https://github.com/stream-utils/stream-to-array/issues"
},
"bundleDependencies": false,
"dependencies": {
"any-promise": "^1.1.0"
},
"deprecated": false,
"description": "Concatenate a readable stream's data into a single array",
"devDependencies": {
"bluebird": "^3.1.1",
"istanbul": "^0.4.2",
"mocha": "^2.3.3"
},
"files": [
"index.js"
],
"homepage": "https://github.com/stream-utils/stream-to-array#readme",
"keywords": [
"stream",
"streams",
"buffer",
"array",
"concat"
],
"license": "MIT",
"name": "stream-to-array",
"repository": {
"type": "git",
"url": "git+https://github.com/stream-utils/stream-to-array.git"
},
"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"
},
"version": "2.3.0"
}