How to use cloneable-readable - 3 common examples

To help you get started, we’ve selected a few cloneable-readable 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 hawtio / hawtio-ui / node_modules / vinyl / index.js View on Github external
set: function(val) {
    if (!isBuffer(val) && !isStream(val) && (val !== null)) {
      throw new Error('File.contents can only be a Buffer, a Stream, or null.');
    }

    // Ask cloneable if the stream is a already a cloneable
    // this avoid piping into many streams
    // reducing the overhead of cloning
    if (isStream(val) && !cloneable.isCloneable(val)) {
      val = cloneable(val);
    }

    this._contents = val;
  },
});
github gulpjs / vinyl / index.js View on Github external
set: function(val) {
    if (!isBuffer(val) && !isStream(val) && (val !== null)) {
      throw new Error('File.contents can only be a Buffer, a Stream, or null.');
    }

    // Ask cloneable if the stream is a already a cloneable
    // this avoid piping into many streams
    // reducing the overhead of cloning
    if (isStream(val) && !cloneable.isCloneable(val)) {
      val = cloneable(val);
    }

    this._contents = val;
  },
});
github nfroidure / gulp-ttf2woff / tests / index.mocha.js View on Github external
.pipe(StreamTest[version].toObjects(function(err, objs) {
            if(err) {
              done(err);
            }
            assert.equal(objs.length, 1);
            assert.equal(objs[0].path, 'bibabelula.foo');
            assert(Cloneable.isCloneable(objs[0].contents));
            assert(objs[0].contents._original instanceof Stream.PassThrough);
            done();
          }));

cloneable-readable

Clone a Readable stream, safely

MIT
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis

Popular cloneable-readable functions