You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
export function isStream(stream, {checkOpen = true} = {}) { return stream !== null && typeof stream === 'object' && (stream.writable || stream.readable || !checkOpen || (stream.writable === undefined && stream.readable === undefined)) && typeof stream.pipe === 'function';}
export function isWritableStream(stream, {checkOpen = true} = {}) { return isStream(stream, {checkOpen}) && (stream.writable || !checkOpen) && typeof stream.write === 'function' && typeof stream.end === 'function' && typeof stream.writable === 'boolean' && typeof stream.writableObjectMode === 'boolean' && typeof stream.destroy === 'function' && typeof stream.destroyed === 'boolean';}
export function isReadableStream(stream, {checkOpen = true} = {}) { return isStream(stream, {checkOpen}) && (stream.readable || !checkOpen) && typeof stream.read === 'function' && typeof stream.readable === 'boolean' && typeof stream.readableObjectMode === 'boolean' && typeof stream.destroy === 'function' && typeof stream.destroyed === 'boolean';}
export function isDuplexStream(stream, options) { return isWritableStream(stream, options) && isReadableStream(stream, options);}
export function isTransformStream(stream, options) { return isDuplexStream(stream, options) && typeof stream._transform === 'function';}
|