Detect if a stream is a file stream
$ npm install --save is-file-stream
const fs = require('fs');
const isFileStream = require('is-file-stream');
const readableFileStream = fs.createReadStream(somePath);
const writableFileStream = fs.createReadStream(someOtherPath);
isFileStream(readableFileStream);
// true
isFileStream(writableFileStream);
// true
isFileStream.readable(writableFileStream);
// false
Returns true
if input
is a file system stream, otherwise returns false
.
Returns true
if input
is a readable file system stream, otherwise returns false
.
Returns true
if input
is a writable file system stream, otherwise returns false
.
Returns true
if input
is a file system stream that is already open, otherwise returns false
.
Returns true
if input
is a readable file system stream that is already open, otherwise returns false
.
Returns true
if input
is a writable file system stream that is already open, otherwise returns false
.
MIT © James Talmage