Поток дуплексный
const isDuplexStream = val =>
val !== null &&
typeof val === 'object' &&
typeof val.pipe === 'function' &&
typeof val._read === 'function' &&
typeof val._readableState === 'object' &&
typeof val._write === 'function' &&
typeof val._writableState === 'object';
JavaScript
const Stream = require('stream');
isDuplexStream(new Stream.Duplex()); // true
JavaScript
Типы
JavaScript