The
writable.writable property is an inbuilt application programming interface of Stream module which is used to check the writable.write() method is safe to call or not.
Syntax:
writable.writable
Return Value: It returns true if it is safe to call writable.write() method otherwise returns false.
Below examples illustrate the use of
writable.writable property in Node.js:
Example 1:
Output:
hi
GFG
true
Example 2:
Output:
hi
GFG
false
In the above example the output is false because the writable.end() method is called before calling the writable.writable property, so it is not safe to call writable.write() method so the output is false.
Reference: https://nodejs.org/api/stream.html#stream_writable_writable