How to use the is-stream.writable function in is-stream

To help you get started, we’ve selected a few is-stream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github roccomuso / transfer-sh / index.js View on Github external
return new Promise(function (resolve, reject) {
    var wStream = isWritable(destination) ? destination : fs.createWriteStream(destination)
    eos(wStream, function (err) {
      if (err) return reject(new Error('stream had an error or closed early'))
      resolve(this)
    })
    /* start decrypt */
    self.inputStream.pipe(base64.decode())
      .pipe(self.sDecrypt)
      .pipe(wStream)
  })
}
github DevExpress / testcafe / src / reporter / index.js View on Github external
async dispose () {
        if (this.disposed)
            return Promise.resolve();

        this.disposed = true;

        if (!this.outStream || Reporter._isSpecialStream(this.outStream) || !isWritableStream(this.outStream))
            return Promise.resolve();

        const streamFinishedPromise = new Promise(resolve => {
            this.outStream.once('finish', resolve);
            this.outStream.once('error', resolve);
        });

        this.outStream.end();

        return streamFinishedPromise;
    }
}
github DevExpress / testcafe / src / utils / prepare-reporters.js View on Github external
function validateReporterOutput (obj) {
    const isValidReporterOutput = obj === void 0 ||
          typeof obj === 'string' ||
          isWritableStream(obj) ||
          isStreamMock(obj);

    if (!isValidReporterOutput)
        throw new GeneralError(RUNTIME_ERRORS.invalidReporterOutput);
}
github thlorenz / exorcist / index.js View on Github external
var stream = mold.transform(function(src, write) {
    if (!src.sourcemap) {
      if (errorOnMissing) return stream.emit('error', new Error(missingMapMsg));
      stream.emit(
        'missing-map'
        ,   missingMapMsg + '\n'
          + 'Therefore it was piped through as is and no external map file generated.'
      );
      return write(src.source);
    }

    if (isStream(input) && isStream.writable(stream)) {
      return stream.emit('error', new Error('Must provide a writable stream'));
    }

    if (isStream(input) && typeof url !== 'string') {
      return stream.emit('error', new Error('map file URL is required when using stream output'));
    }

    url = url || path.basename(input)
    var separated = separate(src, url, root, base);

    if (isStream(input)) {
      return input.end(separated.json, 'utf8', done);
    }

    mkdirp(path.dirname(input), function (err) {
      if (err) return done(err);
github jamestalmage / is-file-stream / index.js View on Github external
function isWritable(stream) {
	return isStream.writable(stream) && commonCheck(stream);
}
github Sobesednik / node-exiftool / src / lib.js View on Github external
function isWritable(stream) {
    return isStream.writable(stream)
}

is-stream

Check if something is a Node.js stream

MIT
Latest version published 10 months ago

Package Health Score

79 / 100
Full package analysis