through2 2.0.1 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +9 -0
- package/README.md +7 -6
- package/package.json +9 -8
- package/through2.js +1 -1
- package/.npmignore +0 -3
- package/LICENSE +0 -39
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
**Copyright (c) Rod Vagg (the "Original Author") and additional contributors**
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://nodei.co/npm/through2/)
|
|
4
4
|
|
|
5
|
-
**A tiny wrapper around Node streams.Transform (Streams2) to avoid explicit subclassing noise**
|
|
5
|
+
**A tiny wrapper around Node streams.Transform (Streams2/3) to avoid explicit subclassing noise**
|
|
6
6
|
|
|
7
7
|
Inspired by [Dominic Tarr](https://github.com/dominictarr)'s [through](https://github.com/dominictarr/through) in that it's so much easier to make a stream out of a function than it is to set up the prototype chain properly: `through(function (chunk) { ... })`.
|
|
8
8
|
|
|
@@ -20,6 +20,7 @@ fs.createReadStream('ex.txt')
|
|
|
20
20
|
callback()
|
|
21
21
|
}))
|
|
22
22
|
.pipe(fs.createWriteStream('out.txt'))
|
|
23
|
+
.on('finish', () => doSomethingSpecial())
|
|
23
24
|
```
|
|
24
25
|
|
|
25
26
|
Or object streams:
|
|
@@ -39,10 +40,10 @@ fs.createReadStream('data.csv')
|
|
|
39
40
|
|
|
40
41
|
callback()
|
|
41
42
|
}))
|
|
42
|
-
.on('data',
|
|
43
|
+
.on('data', (data) => {
|
|
43
44
|
all.push(data)
|
|
44
45
|
})
|
|
45
|
-
.on('end',
|
|
46
|
+
.on('end', () => {
|
|
46
47
|
doSomethingSpecial(all)
|
|
47
48
|
})
|
|
48
49
|
```
|
|
@@ -64,7 +65,7 @@ The `options` argument is first, unlike standard convention, because if I'm pass
|
|
|
64
65
|
```js
|
|
65
66
|
fs.createReadStream('/tmp/important.dat')
|
|
66
67
|
.pipe(through2({ objectMode: true, allowHalfOpen: false },
|
|
67
|
-
|
|
68
|
+
(chunk, enc, cb) => {
|
|
68
69
|
cb(null, 'wut?') // note we can use the second argument on the callback
|
|
69
70
|
// to provide data as an alternative to this.push('wut?')
|
|
70
71
|
}
|
|
@@ -89,7 +90,7 @@ The optional `flushFunction` is provided as the last argument (2nd or 3rd, depen
|
|
|
89
90
|
```js
|
|
90
91
|
fs.createReadStream('/tmp/important.dat')
|
|
91
92
|
.pipe(through2(
|
|
92
|
-
|
|
93
|
+
(chunk, enc, cb) => cb(null, chunk), // transform is a noop
|
|
93
94
|
function (cb) { // flush function
|
|
94
95
|
this.push('tacking on an extra buffer to the end');
|
|
95
96
|
cb();
|
|
@@ -130,4 +131,4 @@ var converter = FToC({objectMode: true})
|
|
|
130
131
|
|
|
131
132
|
## License
|
|
132
133
|
|
|
133
|
-
**through2** is Copyright (c)
|
|
134
|
+
**through2** is Copyright (c) Rod Vagg [@rvagg](https://twitter.com/rvagg) and additional contributors and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "through2",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise",
|
|
5
5
|
"main": "through2.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "node test/test.js | faucet"
|
|
8
|
-
"test-local": "brtapsauce-local test/basic-test.js"
|
|
7
|
+
"test": "node test/test.js | faucet"
|
|
9
8
|
},
|
|
10
9
|
"repository": {
|
|
11
10
|
"type": "git",
|
|
@@ -20,13 +19,15 @@
|
|
|
20
19
|
"author": "Rod Vagg <r@va.gg> (https://github.com/rvagg)",
|
|
21
20
|
"license": "MIT",
|
|
22
21
|
"dependencies": {
|
|
23
|
-
"readable-stream": "~2.
|
|
24
|
-
"xtend": "~4.0.
|
|
22
|
+
"readable-stream": "~2.3.6",
|
|
23
|
+
"xtend": "~4.0.1"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
|
-
"bl": "~0.
|
|
26
|
+
"bl": "~2.0.1",
|
|
28
27
|
"faucet": "0.0.1",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
28
|
+
"nyc": "~13.1.0",
|
|
29
|
+
"safe-buffer": "~5.1.2",
|
|
30
|
+
"stream-spigot": "~3.0.6",
|
|
31
|
+
"tape": "~4.9.1"
|
|
31
32
|
}
|
|
32
33
|
}
|
package/through2.js
CHANGED
package/.npmignore
DELETED
package/LICENSE
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
Copyright 2013, Rod Vagg (the "Original Author")
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
MIT +no-false-attribs License
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person
|
|
7
|
-
obtaining a copy of this software and associated documentation
|
|
8
|
-
files (the "Software"), to deal in the Software without
|
|
9
|
-
restriction, including without limitation the rights to use,
|
|
10
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
copies of the Software, and to permit persons to whom the
|
|
12
|
-
Software is furnished to do so, subject to the following
|
|
13
|
-
conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be
|
|
16
|
-
included in all copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
Distributions of all or part of the Software intended to be used
|
|
19
|
-
by the recipients as they would use the unmodified Software,
|
|
20
|
-
containing modifications that substantially alter, remove, or
|
|
21
|
-
disable functionality of the Software, outside of the documented
|
|
22
|
-
configuration mechanisms provided by the Software, shall be
|
|
23
|
-
modified such that the Original Author's bug reporting email
|
|
24
|
-
addresses and urls are either replaced with the contact information
|
|
25
|
-
of the parties responsible for the changes, or removed entirely.
|
|
26
|
-
|
|
27
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
28
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
29
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
30
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
31
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
32
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
33
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
34
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Except where noted, this license applies to any and all software
|
|
38
|
-
programs and associated documentation files created by the
|
|
39
|
-
Original Author, when distributed with the Software.
|