is-stream - Check if something is a Node.js stream
发布于 1 个月前 作者 9527 84 次浏览 来自 前端开源库

is-stream

Check if something is a Node.js stream

Install

$ npm install --save is-stream

Usage

const fs = require('fs');
const isStream = require('is-stream');

isStream(fs.createReadStream('unicorn.png'));
//=> true

isStream({});
//=> false

API

isStream(stream)

isStream.writable(stream)

isStream.readable(stream)

isStream.duplex(stream)

isStream.transform(stream)

License

MIT © Sindre Sorhus

回到顶部