Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Oct 1, 2023 via pnpm

through 2.3.8

simplified stream construction
Package summary
Share
0
issues
1
license
1
MIT
Package created
4 Jul 2012
Version published
3 Jul 2015
Maintainers
1
Total versions
29
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
Packages
through@2.3.8
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Dependencies

1
Get CSV
Name Version Size License Type Vulnerabilities
through 2.3.8 4.36 kB MIT prod

Visualizations

Frequently Asked Questions

What does through do?

Through is an easy-to-use JavaScript module that lets developers create a stream that is both readable and writable. It's a core building block for most of the synchronous streams in event-stream. Optionally, through can be used with write and end methods to manage stream data. It also handles pause/resume logic automatically when you use this.queue(data) as opposed to this.emit('data', data). You can check this.paused to observe the current flow state. Through is particularly helpful for those looking to simplify their stream construction in Node.js.

How do you use through?

Through can be used in a few ways in JavaScript code. To use through, you first need to require it using the require function. Here is an example of using through with the write and optional end methods:

var through = require('through')

through(function write(data) {
    this.queue(data) 
  },
  function end () {
    this.queue(null)
  })

You could also use it without buffering on pause. Here's a code snippet for this:

var through = require('through')

through(function write(data) {
    this.emit('data', data)
  },
  function end () {
    this.emit('end')
  })

The autoDestroy property can be set to false if you don't want through to automatically emit close when the readable and writable aspects of the stream have ended.

var through = require('through')

var ts = through(write, end, {autoDestroy: false})
//or 
var ts = through(write, end)
ts.autoDestroy = false

Where are the through docs?

The documentation for through can be found directly in the source code and the readme file of the npm package on GitHub. This contains all the basic information needed to comprehend and utilize the library. If you're looking to understand through in-depth, though, the codebase itself is relatively simple and well-suited to a detailed read-through for seasoned JavaScript developers.