aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-14 22:29:51 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-17 20:27:54 -0700
commit0fd493fd781cfaaa704f08751f4239dd36ec5492 (patch)
treec506f4762166ad1acfcd26f332cd913d27aa9c88 /src/bun.js
parentba43fdf317b5c9a7c5df4272a9e4eed6626da442 (diff)
downloadbun-0fd493fd781cfaaa704f08751f4239dd36ec5492.tar.gz
bun-0fd493fd781cfaaa704f08751f4239dd36ec5492.tar.zst
bun-0fd493fd781cfaaa704f08751f4239dd36ec5492.zip
Add stream tester app
Diffstat (limited to 'src/bun.js')
-rw-r--r--src/bun.js/base.zig10
1 files changed, 10 insertions, 0 deletions
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());