Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80529 views
1
var path = require('path');
2
var test = require('tape');
3
4
var Writable = require('../').Writable;
5
var inherits = require('inherits');
6
7
inherits(TestWritable, Writable);
8
9
function TestWritable(opt) {
10
if (!(this instanceof TestWritable))
11
return new TestWritable(opt);
12
Writable.call(this, opt);
13
this._written = [];
14
}
15
16
TestWritable.prototype._write = function(chunk, encoding, cb) {
17
this._written.push(chunk);
18
cb();
19
};
20
21
var buf = Buffer([ 88 ]);
22
23
test('.writable writing ArrayBuffer', function(t) {
24
var writable = new TestWritable();
25
26
writable.write(buf);
27
writable.end();
28
29
t.equal(writable._written.length, 1);
30
t.equal(writable._written[0].toString(), 'X')
31
t.end()
32
});
33
34