Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
},
});
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;
},
});
.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();
}));