diff options
| author | 8cy <[email protected]> | 2020-04-03 02:37:42 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-03 02:37:42 -0700 |
| commit | 60867fb030bae582082340ead7dbc7efdc2f5398 (patch) | |
| tree | 4c6a7356351be2e4914e15c4703172597c45656e /node_modules/simple-concat | |
| parent | commenting (diff) | |
| download | s5nical-60867fb030bae582082340ead7dbc7efdc2f5398.tar.xz s5nical-60867fb030bae582082340ead7dbc7efdc2f5398.zip | |
2020/04/03, 02:34, v1.2.0
Diffstat (limited to 'node_modules/simple-concat')
| -rw-r--r-- | node_modules/simple-concat/.travis.yml | 3 | ||||
| -rw-r--r-- | node_modules/simple-concat/LICENSE | 20 | ||||
| -rw-r--r-- | node_modules/simple-concat/README.md | 42 | ||||
| -rw-r--r-- | node_modules/simple-concat/index.js | 14 | ||||
| -rw-r--r-- | node_modules/simple-concat/package.json | 58 | ||||
| -rw-r--r-- | node_modules/simple-concat/test/basic.js | 41 |
6 files changed, 178 insertions, 0 deletions
diff --git a/node_modules/simple-concat/.travis.yml b/node_modules/simple-concat/.travis.yml new file mode 100644 index 0000000..f178ec0 --- /dev/null +++ b/node_modules/simple-concat/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - 'node' diff --git a/node_modules/simple-concat/LICENSE b/node_modules/simple-concat/LICENSE new file mode 100644 index 0000000..c7e6852 --- /dev/null +++ b/node_modules/simple-concat/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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. diff --git a/node_modules/simple-concat/README.md b/node_modules/simple-concat/README.md new file mode 100644 index 0000000..572e99c --- /dev/null +++ b/node_modules/simple-concat/README.md @@ -0,0 +1,42 @@ +# simple-concat [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] + +[travis-image]: https://img.shields.io/travis/feross/simple-concat/master.svg +[travis-url]: https://travis-ci.org/feross/simple-concat +[npm-image]: https://img.shields.io/npm/v/simple-concat.svg +[npm-url]: https://npmjs.org/package/simple-concat +[downloads-image]: https://img.shields.io/npm/dm/simple-concat.svg +[downloads-url]: https://npmjs.org/package/simple-concat + +### Super-minimalist version of `concat-stream`. Less than 15 lines! + +## install + +``` +npm install simple-concat +``` + +## usage + +This example is longer than the implementation. + +```js +var s = new stream.PassThrough() +concat(s, function (err, buf) { + if (err) throw err + console.error(buf) +}) +s.write('abc') +setTimeout(function () { + s.write('123') +}, 10) +setTimeout(function () { + s.write('456') +}, 20) +setTimeout(function () { + s.end('789') +}, 30) +``` + +## license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/simple-concat/index.js b/node_modules/simple-concat/index.js new file mode 100644 index 0000000..c2d8860 --- /dev/null +++ b/node_modules/simple-concat/index.js @@ -0,0 +1,14 @@ +module.exports = function (stream, cb) { + var chunks = [] + stream.on('data', function (chunk) { + chunks.push(chunk) + }) + stream.once('end', function () { + if (cb) cb(null, Buffer.concat(chunks)) + cb = null + }) + stream.once('error', function (err) { + if (cb) cb(err) + cb = null + }) +} diff --git a/node_modules/simple-concat/package.json b/node_modules/simple-concat/package.json new file mode 100644 index 0000000..f74994e --- /dev/null +++ b/node_modules/simple-concat/package.json @@ -0,0 +1,58 @@ +{ + "_from": "simple-concat@^1.0.0", + "_id": "[email protected]", + "_inBundle": false, + "_integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=", + "_location": "/simple-concat", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "simple-concat@^1.0.0", + "name": "simple-concat", + "escapedName": "simple-concat", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/simple-get" + ], + "_resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "_shasum": "7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6", + "_spec": "simple-concat@^1.0.0", + "_where": "E:\\Documents\\GitHub\\s5nical\\node_modules\\simple-get", + "author": { + "name": "Feross Aboukhadijeh", + "email": "[email protected]", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/simple-concat/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Super-minimalist version of `concat-stream`. Less than 15 lines!", + "devDependencies": { + "standard": "^6.0.8", + "tape": "^4.0.0" + }, + "homepage": "https://github.com/feross/simple-concat", + "keywords": [ + "concat", + "concat-stream", + "concat stream" + ], + "license": "MIT", + "main": "index.js", + "name": "simple-concat", + "repository": { + "type": "git", + "url": "git://github.com/feross/simple-concat.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + }, + "version": "1.0.0" +} diff --git a/node_modules/simple-concat/test/basic.js b/node_modules/simple-concat/test/basic.js new file mode 100644 index 0000000..f781294 --- /dev/null +++ b/node_modules/simple-concat/test/basic.js @@ -0,0 +1,41 @@ +var concat = require('../') +var stream = require('stream') +var test = require('tape') + +test('basic', function (t) { + t.plan(2) + var s = new stream.PassThrough() + concat(s, function (err, buf) { + t.error(err) + t.deepEqual(buf, new Buffer('abc123456789')) + }) + s.write('abc') + setTimeout(function () { + s.write('123') + }, 10) + setTimeout(function () { + s.write('456') + }, 20) + setTimeout(function () { + s.end('789') + }, 30) +}) + +test('error', function (t) { + t.plan(2) + var s = new stream.PassThrough() + concat(s, function (err, buf) { + t.ok(err, 'got expected error') + t.ok(!buf) + }) + s.write('abc') + setTimeout(function () { + s.write('123') + }, 10) + setTimeout(function () { + s.write('456') + }, 20) + setTimeout(function () { + s.emit('error', new Error('error')) + }, 30) +}) |