Check if a CreateWriteStream is writable in Node.js using Javascript
const isWritableStream = val =>
val !== null &&
typeof val === 'object' &&
typeof val.pipe === 'function' &&
typeof val._write === 'function' &&
typeof val._writableState === 'object';
const fs = require('fs');
isWritableStream(fs.createWriteStream('test.txt')); // true
Tags: CreateWriteStream, filesystem, fs, WriteStream, Node.js, Node, Javascript, Typescript
CC BY 4.0 no changes made – 30 Seconds of Code
RELATED WEBSITES AND SERVICES
These are paid advertisements or products and services ran by ourselves
Privacy preserving, cookieless website visitor tracking for your website completely free. unrive.io
Choose from over 100 quick & easy to use SEO, webmaster and developer tools. seoyex.com
Lorum Ipsum Generator, List Randomiser Tool, List Alphabetizer Tools, Case Converter Tools. seoyex.com
CSS Minifier, JS Minifier, HTML Formatter, CSS Formatter, JS Obfuscator Tools. unrivewebtools.com