Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

through2

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

through2 - npm Package Compare versions

Comparing version 0.6.2 to 0.6.3

4

package.json
{
"name": "through2",
"version": "0.6.2",
"version": "0.6.3",
"description": "A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise",

@@ -23,3 +23,3 @@ "main": "through2.js",

"dependencies": {
"readable-stream": ">=1.0.28 <1.1.0-0",
"readable-stream": ">=1.0.33-1 <1.1.0-0",
"xtend": ">=4.0.0 <4.1.0-0"

@@ -26,0 +26,0 @@ },

@@ -31,3 +31,2 @@ # through2

.pipe(through2(function (chunk, enc, callback) {
for (var i = 0; i < chunk.length; i++)

@@ -40,3 +39,2 @@ if (chunk[i] == 97)

callback()
}))

@@ -54,3 +52,2 @@ .pipe(fs.createWriteStream('out.txt'))

.pipe(through2.obj(function (chunk, enc, callback) {
var data = {

@@ -61,7 +58,5 @@ name : chunk[0]

}
this.push(data)
callback()
}))

@@ -92,8 +87,8 @@ .on('data', function (data) {

fs.createReadStream('/tmp/important.dat')
.pipe(through2({ objectMode: true, allowHalfOpen: false }, function (chunk, enc, cb) {
this.push(new Buffer('wut?'))
cb()
})
.pipe(through2({ objectMode: true, allowHalfOpen: false },
function (chunk, enc, cb) {
cb(null, 'wut?') // note we can use the second argument on the callback
// to provide data as an alternative to this.push('wut?')
}
)
.pipe(fs.createWriteStream('/tmp/wut.txt'))

@@ -116,2 +111,14 @@ ```

```js
fs.createReadStream('/tmp/important.dat')
.pipe(through2(
function (chunk, enc, cb) { cb(null, chunk) }, // transform is a noop
function (cb) { // flush function
this.push('tacking on an extra buffer to the end');
cb();
}
))
.pipe(fs.createWriteStream('/tmp/wut.txt'));
```
<b><code>through2.ctor([ options, ] transformFunction[, flushFunction ])</code></b>

@@ -118,0 +125,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc