This commit is contained in:
zino
2021-03-02 00:06:38 +01:00
parent 3a8aab0e9a
commit eeb745b013
3567 changed files with 1234741 additions and 0 deletions

33
client/node_modules/stream-browserify/test/buf.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
var path = require('path');
var test = require('tape');
var Buffer = require('safe-buffer').Buffer;
var Writable = require('..').Writable;
var inherits = require('inherits');
inherits(TestWritable, Writable);
function TestWritable(opt) {
if (!(this instanceof TestWritable))
return new TestWritable(opt);
Writable.call(this, opt);
this._written = [];
}
TestWritable.prototype._write = function(chunk, encoding, cb) {
this._written.push(chunk);
cb();
};
var buf = Buffer.from([ 88 ]);
test('.writable writing ArrayBuffer', function(t) {
var writable = new TestWritable();
writable.write(buf);
writable.end();
t.equal(writable._written.length, 1);
t.equal(writable._written[0].toString(), 'X')
t.end()
});

2
client/node_modules/stream-browserify/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
require('./buf');
require('./pipeline');

38
client/node_modules/stream-browserify/test/pipeline.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
var test = require('tape');
var pipeline = require('..').pipeline;
var stream = require('..');
var Buffer = require('safe-buffer').Buffer;
test('supports pipeline', function(t) {
t.plan(4);
var readable = new stream.Readable({
read: function () {
this.push(Buffer.from('chunk', 'ascii'));
}
});
var transform1 = new stream.Transform({
transform: function (chunk, enc, cb) {
cb(new Error('fail'));
}
});
var transform2 = new stream.PassThrough();
transform2.on('close', function () {
t.pass('transform2.close called');
});
var writable = new stream.Writable({
write: function (chunk, enc, cb) { cb(); }
});
writable.on('close', function () {
t.pass('writable.close called');
});
pipeline(
readable,
transform1,
transform2,
writable,
function(err) {
t.ok(err);
t.equal(err.message, 'fail');
});
});

View File

@@ -0,0 +1,4 @@
// browserify plugin to swap out the `stream` builtin node shim with the stream-browserify version in this repo.
module.exports = function (b) {
b._mdeps.options.modules.stream = require.resolve('../index.js');
};