Update src/index.ts

This commit is contained in:
fwqaaq 2023-12-24 02:43:20 +08:00 committed by GitHub
parent 79494587cd
commit 2d4ed1da90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,6 +213,7 @@ async function handle_get(request: Request, bucket: R2Bucket): Promise<Response>
const rangeStream = new ReadableStream<Uint8Array>({ const rangeStream = new ReadableStream<Uint8Array>({
async start(controller) { async start(controller) {
for (const [start, end] of r) { for (const [start, end] of r) {
// The privous 404 response has already handled, so it can't be null here.
const object = (await bucket.get(resource_path, { const object = (await bucket.get(resource_path, {
range: { offset: start, length: end - start + 1 }, range: { offset: start, length: end - start + 1 },
}))!; }))!;