I would like to know how to check if a value/argument/resource in node.js is a writable stream.
Is there a function or method to do that?
Thanks
I would like to know how to check if a value/argument/resource in node.js is a writable stream.
Is there a function or method to do that?
Thanks
You can just check
// include node stream module
const stream = require('stream');
// check if stream is an instance of a Writable Stream
let isWritableStream = yourStream instanceof stream.Writable
Note: in your program, your customized "Writable Stream Classes" should extends the stream.Writable
class. In order to extends it you may check How to implement a writable stream (Stack Overflow)
References: