From 0fd493fd781cfaaa704f08751f4239dd36ec5492 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Fri, 14 Jul 2023 22:29:51 -0700 Subject: Add stream tester app --- src/bun.js/base.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/bun.js') diff --git a/src/bun.js/base.zig b/src/bun.js/base.zig index 535c08395..b9dba8b37 100644 --- a/src/bun.js/base.zig +++ b/src/bun.js/base.zig @@ -1784,6 +1784,16 @@ pub const ArrayBuffer = extern struct { }; } + pub fn createFromLength(globalThis: *JSC.JSGlobalObject, len: usize, comptime kind: BinaryType) JSValue { + JSC.markBinding(@src()); + return switch (comptime kind) { + .Uint8Array => Bun__createUint8ArrayForCopy(globalThis, null, len, false), + .Buffer => Bun__createUint8ArrayForCopy(globalThis, null, len, true), + .ArrayBuffer => Bun__createArrayBufferForCopy(globalThis, null, len), + else => @compileError("Not implemented yet"), + }; + } + pub fn createEmpty(globalThis: *JSC.JSGlobalObject, comptime kind: JSC.JSValue.JSType) JSValue { JSC.markBinding(@src()); -- cgit v1.2.3