The
writable.destroyed property is an inbuilt application programming interface of Stream module which is used to check the writable.destroy() method is being called or not.
Syntax:
writable.destroyed
Return Value: This property returns true if writable.destroy() method is called before it else it returns false.
Below examples illustrate the use of
writable.destroyed property in Node.js:
Example 1:
Output:
hi
hello
true
Example 2:
Output:
hi
hello
false
In the above example the output is false as
writable.destroy() method is not called before calling the property writable.destroyed.
Reference: https://nodejs.org/api/stream.html#stream_writable_destroyed