From 43989925480f8326cdb602f23265c2191a9e1d1d Mon Sep 17 00:00:00 2001 From: Meng-Yuan Huang Date: Sat, 28 May 2022 11:57:27 +0800 Subject: [PATCH] fix: allow `Uint8Array`s to be passed to `FsWriteStream` (#842) --- src/volume.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/volume.ts b/src/volume.ts index 5f7f7128f..10d8dfb53 100644 --- a/src/volume.ts +++ b/src/volume.ts @@ -2567,7 +2567,7 @@ FsWriteStream.prototype.open = function() { }; FsWriteStream.prototype._write = function(data, encoding, cb) { - if (!(data instanceof Buffer)) return this.emit('error', new Error('Invalid data')); + if (!(data instanceof Buffer || data instanceof Uint8Array)) return this.emit('error', new Error('Invalid data')); if (typeof this.fd !== 'number') { return this.once('open', function() {