Socket
Socket
Sign inDemoInstall

minipass

Package Overview
Dependencies
Maintainers
6
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minipass - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

31

index.js

@@ -61,2 +61,3 @@ 'use strict'

constructor (src, dest, opts) {
this.src = src
this.dest = dest

@@ -67,9 +68,25 @@ this.opts = opts

}
unpipe () {
this.dest.removeListener('drain', this.ondrain)
}
// istanbul ignore next - only here for the prototype
proxyErrors () {}
end () {
this.unpipe()
if (this.opts.end)
this.dest.end()
this.dest.removeListener('drain', this.ondrain)
}
}
class PipeProxyErrors extends Pipe {
unpipe () {
this.src.removeListener('error', this.proxyErrors)
super.unpipe()
}
constructor (src, dest, opts) {
super(src, dest, opts)
this.proxyErrors = er => dest.emit('error', er)
src.on('error', this.proxyErrors)
}
}

@@ -366,2 +383,3 @@ module.exports = class Minipass extends Stream {

opts.end = opts.end !== false
opts.proxyErrors = !!opts.proxyErrors

@@ -373,3 +391,4 @@ // piping an ended stream ends immediately

} else {
this.pipes.push(new Pipe(this, dest, opts))
this.pipes.push(!opts.proxyErrors ? new Pipe(this, dest, opts)
: new PipeProxyErrors(this, dest, opts))
if (this[ASYNC])

@@ -384,2 +403,10 @@ defer(() => this[RESUME]())

unpipe (dest) {
const p = this.pipes.find(p => p.dest === dest)
if (p) {
this.pipes.splice(this.pipes.indexOf(p), 1)
p.unpipe()
}
}
addListener (ev, fn) {

@@ -386,0 +413,0 @@ return this.on(ev, fn)

{
"name": "minipass",
"version": "3.2.1",
"version": "3.3.0",
"description": "minimal implementation of a PassThrough stream",

@@ -10,5 +10,9 @@ "main": "index.js",

"devDependencies": {
"@types/node": "^17.0.41",
"end-of-stream": "^1.4.0",
"prettier": "^2.6.2",
"tap": "^16.2.0",
"through2": "^2.0.3"
"through2": "^2.0.3",
"ts-node": "^10.8.1",
"typescript": "^4.7.3"
},

@@ -39,3 +43,14 @@ "scripts": {

"node": ">=8"
},
"prettier": {
"semi": false,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"jsxSingleQuote": false,
"bracketSameLine": true,
"arrowParens": "avoid",
"endOfLine": "lf"
}
}

23

README.md

@@ -20,5 +20,2 @@ # minipass

There is also no `unpipe()` method. Once you start piping, there is no
stopping it!
If you set `objectMode: true` in the options, then whatever is written will

@@ -387,2 +384,6 @@ be emitted. Otherwise, it'll do a minimal amount of Buffer copying to

value.
* `async` Defaults to `false`. Set to `true` to defer data
emission until next tick. This reduces performance slightly,
but makes Minipass streams use timing behavior closer to Node
core streams. See [Timing](#timing) for more details.

@@ -409,5 +410,15 @@ ### API

discarded. Any buffered events are immediately emitted.
* `pipe(dest)` - Send all output to the stream provided. There is no way
to unpipe. When data is emitted, it is immediately written to any and
all pipe destinations.
* `pipe(dest)` - Send all output to the stream provided. When
data is emitted, it is immediately written to any and all pipe
destinations. (Or written on next tick in `async` mode.)
* `unpipe(dest)` - Stop piping to the destination stream. This
is immediate, meaning that any asynchronously queued data will
_not_ make it to the destination when running in `async` mode.
* `options.end` - Boolean, end the destination stream when
the source stream ends. Default `true`.
* `options.proxyErrors` - Boolean, proxy `error` events from
the source stream to the destination stream. Note that
errors are _not_ proxied after the pipeline terminates,
either due to the source emitting `'end'` or manually
unpiping with `src.unpipe(dest)`. Default `false`.
* `on(ev, fn)`, `emit(ev, fn)` - Minipass streams are EventEmitters. Some

@@ -414,0 +425,0 @@ events are given special treatment, however. (See below under "events".)

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