isstream
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
isStream is a useful npm package in JavaScript that determines if an object is a standard Node.js Stream. It proficiently works with Node-core Stream objects (for versions 0.8, 0.10, 0.11, and theoretically, older and newer versions) and all versions of readable-stream. It is aptly described as the missing Stream.isStream(obj)
in Node.js.
Utilizing isStream in your code is remarkably simple. To include isStream functionality, require the package as follows: var isStream = require('isstream')
. After using require
to include the package, use it to verify if an object is a Stream using the following coding pattern:
var Stream = require('stream');
var isStream = require('isstream');
console.log(isStream(new Stream())); // true
console.log(isStream({})); // false
console.log(isStream(new Stream.Readable())); // true
Apart from the general isStream
functionality, isStream also provides specific methods to test if an object is a readable, writable, or duplex stream i.e., isReadable(obj)
, isWritable(obj)
, and isDuplex(obj)
respectively. Below is an example of how you can use these methods:
var Stream = require('stream');
var isReadable = require('isstream').isReadable;
console.log(isReadable(new Stream.Readable())); // true
As for documentation, the isStream descriptive details are primarily available on its GitHub repository page: https://github.com/rvagg/isstream. The repository's README.md file uses clear and concise examples to illustrate what isStream does, how to use it, and how it can be integrated into a project. For additional information or to familiarize oneself with any changes or updates to the isStream package, it's advisable to revisit the GitHub page regularly or follow the publisher's notifications.