All Projects → stream-utils → destroy

stream-utils / destroy

Licence: MIT License
destroy a stream if possible

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to destroy

psql-streamer
Stream database events from PostgreSQL to Kafka
Stars: ✭ 37 (-27.45%)
Mutual labels:  stream
web-streams-polyfill
Web Streams, based on the WHATWG spec reference implementation
Stars: ✭ 198 (+288.24%)
Mutual labels:  stream
Huong-dan-cai-dat-stream-server-va-chuyen-doi-video-sang-streaming
Hướng dẫn cài đặt stream server và chuyển đổi video thường sang dạng TS Streaming
Stars: ✭ 29 (-43.14%)
Mutual labels:  stream
chromecast-api
📺 Chromecast Node.js module
Stars: ✭ 122 (+139.22%)
Mutual labels:  stream
Streamator
A Spectator Specifically build for Content Creation and Streaming
Stars: ✭ 18 (-64.71%)
Mutual labels:  stream
meros
🪢 A fast utility that makes reading multipart responses simple
Stars: ✭ 109 (+113.73%)
Mutual labels:  stream
stream
Stream API for Go.
Stars: ✭ 43 (-15.69%)
Mutual labels:  stream
gulp-yaml
A Gulp plugin to convert YAML to JSON
Stars: ✭ 24 (-52.94%)
Mutual labels:  stream
stream
Stream. Curating your streams (MIT) License
Stars: ✭ 15 (-70.59%)
Mutual labels:  stream
livego
直播服务器 hls stream online RTMP AMF HLS HTTP-FLV
Stars: ✭ 30 (-41.18%)
Mutual labels:  stream
TogetherStream
A social and synchronized streaming experience
Stars: ✭ 16 (-68.63%)
Mutual labels:  stream
mongoose-gridfs
mongoose gridfs on top of new gridfs api
Stars: ✭ 79 (+54.9%)
Mutual labels:  stream
videowall
Video wall with multiple tiles that enables synchronized video playback, mirrored or tiled.
Stars: ✭ 57 (+11.76%)
Mutual labels:  stream
Stream-to-VLC
Tampermonkey script that uses a custom URI scheme to view streams in VLC.
Stars: ✭ 20 (-60.78%)
Mutual labels:  stream
futura
Asynchronous Swift made easy. The project was made by Miquido. https://www.miquido.com/
Stars: ✭ 34 (-33.33%)
Mutual labels:  stream
lectures
My free and open source tutorials/books on JS and Java 📖 🌹📚
Stars: ✭ 35 (-31.37%)
Mutual labels:  stream
Diffy
🎞️💓🍿 Love streaming - It's always best to watch a movie together ! 🤗
Stars: ✭ 37 (-27.45%)
Mutual labels:  stream
streamdelay
A delay + dump button for live streams, allowing screening and redaction of explict content.
Stars: ✭ 31 (-39.22%)
Mutual labels:  stream
callbag-rs
Rust implementation of the callbag spec for reactive/iterable programming
Stars: ✭ 25 (-50.98%)
Mutual labels:  stream
sample
Produce a sample of lines from files.
Stars: ✭ 17 (-66.67%)
Mutual labels:  stream

Destroy

NPM version Build Status Test coverage License Downloads

Destroy a stream.

This module is meant to ensure a stream gets destroyed, handling different APIs and Node.js bugs.

API

var destroy = require('destroy')

destroy(stream)

Destroy the given stream. In most cases, this is identical to a simple stream.destroy() call. The rules are as follows for a given stream:

  1. If the stream is an instance of ReadStream, then call stream.destroy() and add a listener to the open event to call stream.close() if it is fired. This is for a Node.js bug that will leak a file descriptor if .destroy() is called before open.
  2. If the stream is an instance of a zlib stream, then call stream.destroy() and close the underlying zlib handle if open, otherwise call stream.close(). This is for consistency across Node.js versions and a Node.js bug that will leak a native zlib handle.
  3. If the stream is not an instance of Stream, then nothing happens.
  4. If the stream has a .destroy() method, then call it.

The function returns the stream passed in as the argument.

Example

var destroy = require('destroy')

var fs = require('fs')
var stream = fs.createReadStream('package.json')

// ... and later
destroy(stream)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].