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

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 4.1.0 to 4.2.0

15

index.d.ts

@@ -29,17 +29,19 @@ /// <reference types="node" />

interface StringOptions {
interface SharedOptions {
async?: boolean
signal?: AbortSignal
}
interface StringOptions extends SharedOptions {
encoding: BufferEncoding
objectMode?: boolean
async?: boolean
}
interface BufferOptions {
interface BufferOptions extends SharedOptions {
encoding?: null | 'buffer'
objectMode?: boolean
async?: boolean
}
interface ObjectModeOptions {
interface ObjectModeOptions extends SharedOptions {
objectMode: true
async?: boolean
}

@@ -74,2 +76,3 @@

readonly readable: boolean
readonly aborted: boolean
readonly paused: boolean

@@ -76,0 +79,0 @@ readonly emittedEnd: boolean

57

index.js

@@ -42,2 +42,5 @@ 'use strict'

const ASYNC = Symbol('async')
const ABORT = Symbol('abort')
const ABORTED = Symbol('aborted')
const SIGNAL = Symbol('signal')

@@ -101,2 +104,7 @@ const defer = fn => Promise.resolve().then(fn)

super()
this[SIGNAL] = options && options.signal
if (this[SIGNAL]) {
this[SIGNAL].addEventListener('abort', () => this[ABORT]())
}
this[ABORTED] = false
this[FLOWING] = false

@@ -174,2 +182,43 @@ // whether we're explicitly paused

// drop everything and get out of the flow completely
[ABORT]() {
this[ABORTED] = true
const signal = this[SIGNAL]
/* istanbul ignore next */
if (this.write) this.write = () => {}
/* istanbul ignore next */
if (this.end) this.end = () => {}
/* istanbul ignore next */
if (this.pipe) this.pipe = () => {}
/* istanbul ignore next */
this.on = this.addListener = () => {}
/* istanbul ignore next */
this.off = this.removeListener = () => {}
/* istanbul ignore next */
this[ABORT] = () => {}
/* istanbul ignore next */
this.emit = () => {}
for (const p of this[PIPES]) {
p.unpipe()
}
super.removeAllListeners('data')
super.removeAllListeners('end')
super.removeAllListeners('drain')
super.removeAllListeners('resume')
this[BUFFER].length = 0
this.readable = false
this.writable = false
super.emit(ABORT, signal.reason)
super.emit('abort', signal.reason)
super.emit('end')
super.emit('prefinish')
super.emit('finish')
super.emit('close')
}
get aborted() {
return this[ABORTED]
}
set aborted(_) {}
write(chunk, encoding, cb) {

@@ -444,3 +493,3 @@ if (this[EOF]) throw new Error('write after end')

else if (ev === 'data') {
return !data
return !this[OBJECTMODE] && !data
? false

@@ -550,2 +599,3 @@ : this[ASYNC]

this.on('error', er => reject(er))
this.on(ABORT, er => reject(er))
this.on('end', () => resolve())

@@ -580,2 +630,3 @@ })

this.removeListener('error', onerr)
this.removeListener(ABORT, onerr)
this.removeListener('end', onend)

@@ -587,2 +638,3 @@ this.pause()

this.removeListener('error', onerr)
this.removeListener(ABORT, onerr)
this.removeListener('data', ondata)

@@ -598,2 +650,3 @@ stop()

this.once('error', onerr)
this.once(ABORT, onerr)
this.once('end', onend)

@@ -620,2 +673,3 @@ this.once('data', ondata)

this.removeListener(ERROR, stop)
this.removeListener(ABORT, stop)
this.removeListener('end', stop)

@@ -633,2 +687,3 @@ stopped = true

this.once(ERROR, stop)
this.once(ABORT, stop)

@@ -635,0 +690,0 @@ return {

{
"name": "minipass",
"version": "4.1.0",
"version": "4.2.0",
"description": "minimal implementation of a PassThrough stream",

@@ -24,2 +24,3 @@ "main": "./index.js",

"end-of-stream": "^1.4.0",
"node-abort-controller": "^3.1.1",
"prettier": "^2.6.2",

@@ -26,0 +27,0 @@ "tap": "^16.2.0",

@@ -395,2 +395,4 @@ # minipass

core streams. See [Timing](#timing) for more details.
- `signal` An `AbortSignal` that will cause the stream to unhook
itself from everything and become as inert as possible.

@@ -468,8 +470,4 @@ ### API

- `readable` Whether the stream is readable. Default `true`.
- `buffer` A [yallist](http://npm.im/yallist) linked list of chunks written
to the stream that have not yet been emitted. (It's probably a bad idea
to mess with this.)
- `pipes` A [yallist](http://npm.im/yallist) linked list of streams that
this stream is piping into. (It's probably a bad idea to mess with
this.)
- `pipes` An array of Pipe objects referencing streams that this
stream is piping into.
- `destroyed` A getter that indicates whether the stream was destroyed.

@@ -479,2 +477,4 @@ - `paused` True if the stream has been explicitly paused, otherwise false.

to `true`, it cannot be set to `false`.
- `aborted` Readonly property set when the `AbortSignal`
dispatches an `abort` event.

@@ -481,0 +481,0 @@ ### Events

Sorry, the diff of this file is not supported yet

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