How to use the stream.Readable function in stream

To help you get started, we’ve selected a few 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 balena-io / node-ext2fs / test / index.js View on Github external
function createReadableStreamFromString(s) {
	const readable = new stream.Readable();
	readable._read = function () {};
	readable.push(s);
	readable.push(null);
	return readable;
}
github donejs / done-ssr / lib / util / safe_push.js View on Github external
function getReadable(stream) {
	var s = stream;
	if(typeof stream === "string") {
		s = new Readable();
		s._read = Function.prototype;
		s.push(stream);
		s.push(null);
	}
	return s;
}
github open-webrtc-toolkit / QoSTestFramework / mcu-bench_cpp / QOSserver / cipher.js View on Github external
function lock(password, object, filename, cb) {
  let s = new stream.Readable();
  s._read = function noop() {};
  s.push(JSON.stringify(object));
  s.push(null);
  let out = fs.createWriteStream(filename);
  out.on('error', function(e) {
    cb(e);
  });
  out.on('finish', function() {
    cb(null);
  });
  s.pipe(zlib.createGzip()).pipe(crypto.createCipher(algorithm, password)).pipe(
    out);
}
github open-webrtc-toolkit / owt-server / source / common / cipher.js View on Github external
function lock (password, object, filename, cb) {
  var s = new stream.Readable();
  s._read = function noop() {};
  s.push(JSON.stringify(object));
  s.push(null);
  var out = fs.createWriteStream(filename);
  out.on('error', function (e) {
    cb(e);
  });
  out.on('finish', function () {
    cb(null);
  });
  s.pipe(zlib.createGzip()).pipe(crypto.createCipheriv(algorithm, password, iv)).pipe(out);
}
github open-webrtc-toolkit / owt-client-javascript / src / samples / conference / cipher.js View on Github external
function lock(password, object, filename, cb) {
  var s = new stream.Readable();
  s._read = function noop() {};
  s.push(JSON.stringify(object));
  s.push(null);
  var out = fs.createWriteStream(filename);
  out.on('error', function(e) {
    cb(e);
  });
  out.on('finish', function() {
    cb(null);
  });
  s.pipe(zlib.createGzip()).pipe(crypto.createCipher(algorithm, password)).pipe(
    out);
}

stream

Node.js streams in the browser

MIT
Latest version published 6 months ago

Package Health Score

72 / 100
Full package analysis