[bun.js] 2/? Implement Response.file, sendfile edition

This commit is contained in:
Jarred Sumner
2022-03-21 06:32:14 -07:00
parent fa343fa8ad
commit 7cd93e6670
8 changed files with 506 additions and 161 deletions

View File

@@ -298,6 +298,7 @@ pub fn IOTask(comptime Context: type) type {
const AsyncTransformTask = @import("./api/transpiler.zig").TransformTask.AsyncTransformTask;
const BunTimerTimeoutTask = Bun.Timer.Timeout.TimeoutTask;
const ReadFileTask = WebCore.Blob.Store.ReadFile.ReadFileTask;
const OpenAndStatFileTask = WebCore.Blob.Store.OpenAndStatFile.OpenAndStatFileTask;
// const PromiseTask = JSInternalPromise.Completion.PromiseTask;
pub const Task = TaggedPointerUnion(.{
FetchTasklet,
@@ -305,6 +306,7 @@ pub const Task = TaggedPointerUnion(.{
AsyncTransformTask,
BunTimerTimeoutTask,
ReadFileTask,
OpenAndStatFileTask,
// PromiseTask,
// TimeoutTasklet,
});
@@ -533,6 +535,11 @@ pub const VirtualMachine = struct {
transform_task.*.runFromJS();
finished += 1;
},
@field(Task.Tag, @typeName(OpenAndStatFileTask)) => {
var transform_task: *OpenAndStatFileTask = task.get(OpenAndStatFileTask).?;
transform_task.*.runFromJS();
finished += 1;
},
else => unreachable,
}
}