diff options
author | 2022-03-21 02:21:51 -0700 | |
---|---|---|
committer | 2022-03-21 02:21:51 -0700 | |
commit | fa343fa8adb25a7e307e91a3cd3c2c3f24e0152b (patch) | |
tree | 63a7ed4a7d787dd2b61330f5c1e69b2af0737e39 /src/javascript/jsc/node | |
parent | 1f93de264f55e7a392bd34dbb9bda0b2365d7c88 (diff) | |
download | bun-fa343fa8adb25a7e307e91a3cd3c2c3f24e0152b.tar.gz bun-fa343fa8adb25a7e307e91a3cd3c2c3f24e0152b.tar.zst bun-fa343fa8adb25a7e307e91a3cd3c2c3f24e0152b.zip |
[bun.js] 1/? Implement `Response.file`
Diffstat (limited to 'src/javascript/jsc/node')
-rw-r--r-- | src/javascript/jsc/node/types.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/javascript/jsc/node/types.zig b/src/javascript/jsc/node/types.zig index dfb1b63ed..2195dd789 100644 --- a/src/javascript/jsc/node/types.zig +++ b/src/javascript/jsc/node/types.zig @@ -510,6 +510,13 @@ pub const PathOrFileDescriptor = union(Tag) { pub const Tag = enum { fd, path }; + pub fn hash(this: PathOrFileDescriptor) u64 { + return switch (this) { + .path => std.hash.Wyhash.hash(0, this.path.slice()), + .fd => std.hash.Wyhash.hash(0, std.mem.asBytes(&this.fd)), + }; + } + pub fn copyToStream(this: PathOrFileDescriptor, flags: FileSystemFlags, auto_close: bool, mode: Mode, allocator: std.mem.Allocator, stream: *Stream) !void { switch (this) { .fd => |fd| { |