mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 11:29:02 +00:00
[bun.js] 1/? Implement Response.file
This commit is contained in:
@@ -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| {
|
||||
|
||||
Reference in New Issue
Block a user