aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/webcore/streams.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/webcore/streams.zig')
-rw-r--r--src/bun.js/webcore/streams.zig15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bun.js/webcore/streams.zig b/src/bun.js/webcore/streams.zig
index 2e6bbdce2..6c51daf94 100644
--- a/src/bun.js/webcore/streams.zig
+++ b/src/bun.js/webcore/streams.zig
@@ -225,6 +225,7 @@ pub const ReadableStream = struct {
extern fn ReadableStream__isDisturbed(possibleReadableStream: JSValue, globalObject: *JSGlobalObject) bool;
extern fn ReadableStream__isLocked(possibleReadableStream: JSValue, globalObject: *JSGlobalObject) bool;
extern fn ReadableStream__empty(*JSGlobalObject) JSC.JSValue;
+ extern fn ReadableStream__used(*JSGlobalObject) JSC.JSValue;
extern fn ReadableStream__cancel(stream: JSValue, *JSGlobalObject) void;
extern fn ReadableStream__abort(stream: JSValue, *JSGlobalObject) void;
extern fn ReadableStream__detach(stream: JSValue, *JSGlobalObject) void;
@@ -367,6 +368,12 @@ pub const ReadableStream = struct {
return ReadableStream__empty(globalThis);
}
+ pub fn used(globalThis: *JSGlobalObject) JSC.JSValue {
+ JSC.markBinding(@src());
+
+ return ReadableStream__used(globalThis);
+ }
+
const Base = @import("../../ast/base.zig");
pub const StreamTag = enum(usize) {
invalid = 0,
@@ -3596,6 +3603,9 @@ pub const ByteStream = struct {
this.buffer = try std.ArrayList(u8).initCapacity(bun.default_allocator, chunk.len);
this.buffer.appendSliceAssumeCapacity(chunk);
},
+ .err => {
+ this.pending.result = .{ .err = stream.err };
+ },
else => unreachable,
}
return;
@@ -3605,6 +3615,9 @@ pub const ByteStream = struct {
.temporary_and_done, .temporary => {
try this.buffer.appendSlice(chunk);
},
+ .err => {
+ this.pending.result = .{ .err = stream.err };
+ },
// We don't support the rest of these yet
else => unreachable,
}
@@ -3835,7 +3848,7 @@ pub const FIFO = struct {
pub fn getAvailableToReadOnLinux(this: *FIFO) u32 {
var len: c_int = 0;
- const rc: c_int = std.c.ioctl(this.fd, std.os.linux.T.FIONREAD, &len);
+ const rc: c_int = std.c.ioctl(this.fd, std.os.linux.T.FIONREAD, @as(*c_int, &len));
if (rc != 0) {
len = 0;
}