destroy

WebJar for destroy

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

destroy
Last Version

Last Version

1.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

destroy
WebJar for destroy
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/stream-utils/destroy

Download destroy

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/destroy/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>destroy</artifactId>
    <version>1.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/destroy/
implementation 'org.webjars.npm:destroy:1.0.4'
// https://jarcasting.com/artifacts/org.webjars.npm/destroy/
implementation ("org.webjars.npm:destroy:1.0.4")
'org.webjars.npm:destroy:jar:1.0.4'
<dependency org="org.webjars.npm" name="destroy" rev="1.0.4">
  <artifact name="destroy" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='destroy', version='1.0.4')
)
libraryDependencies += "org.webjars.npm" % "destroy" % "1.0.4"
[org.webjars.npm/destroy "1.0.4"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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 not an instance of Stream, then nothing happens.
  3. 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)
org.webjars.npm

Versions

Version
1.0.4
1.0.3