You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

destroy

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

destroy

destroy a stream if possible

1.2.0
latest
Source
npm
Version published
Weekly downloads
29M
-17.83%
Maintainers
2
Weekly downloads
 
Created

What is destroy?

The 'destroy' npm package is used to destroy a stream, such as a request or response, ensuring that it cannot be used anymore. It is particularly useful for ensuring that file descriptors are closed and memory usage is cleaned up after streams are no longer needed.

What are destroy's main functionalities?

Destroy a stream

This code sample demonstrates how to destroy a readable stream using the 'destroy' package. Once the stream is destroyed, it cannot emit any more events or be used to read data.

const destroy = require('destroy');
const fs = require('fs');

const stream = fs.createReadStream('file.txt');
stream.on('data', (chunk) => {
  console.log(chunk);
});

// Destroy the stream
destroy(stream);

Other packages similar to destroy

Keywords

stream

FAQs

Package last updated on 20 Mar 2022

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