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

destroy

Package Overview
Dependencies
Maintainers
1
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.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35M
increased by3.09%
Maintainers
1
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

FAQs

Package last updated on 15 Aug 2014

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

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