Skip to content

Commit f7b6edd

Browse files
committed
Add ArrayBuffer.toBuffer().
1 parent 187bcff commit f7b6edd

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4737,6 +4737,14 @@ Array.prototype.unique = function(property) {
47374737
return result;
47384738
};
47394739

4740+
ArrayBuffer.prototype.toBuffer = function() {
4741+
var buf = new Buffer(this.byteLength);
4742+
var view = new Uint8Array(this);
4743+
for (var i = 0, length = buf.length; i < length; ++i)
4744+
buf[i] = view[i];
4745+
return buf;
4746+
};
4747+
47404748
function AsyncTask(owner, name, fn, cb, waiting) {
47414749
this.isRunning = 0;
47424750
this.owner = owner;

0 commit comments

Comments
 (0)