diff options
author | 2022-09-23 00:26:23 -0700 | |
---|---|---|
committer | 2022-09-23 00:26:23 -0700 | |
commit | 61d0c4042b0c63a29c195485a9a5bbd7fdcd98b7 (patch) | |
tree | e249f5608e9fc3b5da877f1edd13e54b9eb38cb1 /src | |
parent | de0b373c7c373d6d0ded48dd3391404368a20dfd (diff) | |
download | bun-61d0c4042b0c63a29c195485a9a5bbd7fdcd98b7.tar.gz bun-61d0c4042b0c63a29c195485a9a5bbd7fdcd98b7.tar.zst bun-61d0c4042b0c63a29c195485a9a5bbd7fdcd98b7.zip |
Use JSC heap for .arrayBuffer()
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/webcore/response.zig | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/bun.js/webcore/response.zig b/src/bun.js/webcore/response.zig index 428ef6ab4..314844d87 100644 --- a/src/bun.js/webcore/response.zig +++ b/src/bun.js/webcore/response.zig @@ -3549,10 +3549,7 @@ pub const Blob = struct { pub fn toArrayBufferWithBytes(this: *Blob, global: *JSGlobalObject, buf: []u8, comptime lifetime: Lifetime) JSValue { switch (comptime lifetime) { .clone => { - var clone = bun.default_allocator.alloc(u8, buf.len) catch unreachable; - @memcpy(clone.ptr, buf.ptr, buf.len); - - return JSC.ArrayBuffer.fromBytes(clone, .ArrayBuffer).toJS(global.ref(), null); + return JSC.ArrayBuffer.create(global, buf, .ArrayBuffer); }, .share => { this.store.?.ref(); |