aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/base.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/base.zig')
-rw-r--r--src/bun.js/base.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bun.js/base.zig b/src/bun.js/base.zig
index 044a04306..8de560b0f 100644
--- a/src/bun.js/base.zig
+++ b/src/bun.js/base.zig
@@ -1772,6 +1772,14 @@ pub const ArrayBuffer = extern struct {
};
}
+ pub fn createEmpty(globalThis: *JSC.JSGlobalObject, comptime kind: JSC.JSValue.JSType) JSValue {
+ return switch (comptime kind) {
+ .Uint8Array => Bun__createUint8ArrayForCopy(globalThis, null, 0, false),
+ .ArrayBuffer => Bun__createArrayBufferForCopy(globalThis, null, 0),
+ else => @compileError("Not implemented yet"),
+ };
+ }
+
pub fn createBuffer(globalThis: *JSC.JSGlobalObject, bytes: []const u8) JSValue {
JSC.markBinding(@src());
return Bun__createUint8ArrayForCopy(globalThis, bytes.ptr, bytes.len, true);