-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00b5e09
commit a78cb0d
Showing
6 changed files
with
48 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { R2UploadedPart } from "@cloudflare/workers-types"; | ||
|
||
export default eventHandler(async (event) => { | ||
const { | ||
key: key, | ||
id: id, | ||
"uploaded-parts": uploadedPartsHeader, | ||
} = getHeaders(event); | ||
|
||
const binding = useBinding(event); | ||
|
||
const upload = binding.resumeMultipartUpload(key!, id!); | ||
const uploadedParts: R2UploadedPart[] = JSON.parse(uploadedPartsHeader!); | ||
|
||
const object = await upload.complete(uploadedParts); | ||
|
||
return { | ||
ok: true, | ||
key: object.key, | ||
}; | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export default eventHandler(async (event) => { | ||
const { | ||
key: key, | ||
id: id, | ||
"part-number": partNumberHeader, | ||
} = getHeaders(event); | ||
|
||
const partNumber = Number(partNumberHeader); | ||
const binding = useBinding(event); | ||
|
||
const upload = binding.resumeMultipartUpload(key!, id!); | ||
const buffer = (await readRawBody(event, false))!; | ||
const part = await upload.uploadPart(partNumber, buffer); | ||
|
||
return { | ||
ok: true, | ||
part, | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.