You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

on-stream-close

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

on-stream-close

Callback when a stream has closed

1.0.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

on-stream-close

Callback when a stream has closed. Alternative to stream.finished and its predecessor end-of-stream that utilize other events (like end and finish) which makes them compatible with older streams but they can't guarantee the stream has fully cleaned up its resources.

npm status node Travis build status JavaScript Style Guide

Usage

const osc = require('on-stream-close')

osc(stream, function (err) {
  // Stream has closed
})

With promises:

const osc = require('on-stream-close').promises

await osc(stream)

Compatible stream flavors

  • stream: node >= 14.0.0 or >= 10.16.0 if autoDestroy is set to true by implementation
  • readable-stream: >= 3.5.0 if autoDestroy is set to true by implementation
  • streamx: always
  • minipass: not out of the box, an implementation can choose to emit close.

Install

With npm do:

npm install on-stream-close

License

MIT © 2020-present Vincent Weevers

Keywords

stream

FAQs

Package last updated on 24 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts