[Pkg-javascript-commits] [node-stream-browserify] 31/44: Get rid of extra copy operation
Bastien Roucariès
rouca at moszumanska.debian.org
Sun Aug 13 14:18:43 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-stream-browserify.
commit f04b577689dc2a975fe58722dae6b0302c6699be
Author: Feross Aboukhadijeh <feross at feross.org>
Date: Fri Jan 24 23:24:53 2014 -0800
Get rid of extra copy operation
The code assumed that Buffers wouldn’t be `instanceof Uint8Array` but
that’s not true anymore - they are ;)
So it was doing an extra copy via `new Buffer()` - get rid of it.
---
writable.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/writable.js b/writable.js
index efe1f3a..582c638 100644
--- a/writable.js
+++ b/writable.js
@@ -180,7 +180,7 @@ Writable.prototype.write = function(chunk, encoding, cb) {
encoding = null;
}
- if (isUint8Array(chunk))
+ if (!Buffer.isBuffer(chunk) && isUint8Array(chunk))
chunk = new Buffer(chunk);
if (isArrayBuffer(chunk) && typeof Uint8Array !== 'undefined')
chunk = new Buffer(new Uint8Array(chunk));
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-browserify.git
More information about the Pkg-javascript-commits
mailing list