mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-17 16:50:22 +00:00
updating aws-nodejs example listParts logic for resuming uploads (#5192)
Co-authored-by: Mitchell Rhoads <mrhoads@tunego.com> Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
This commit is contained in:
parent
61223e9feb
commit
a5bc28acda
1 changed files with 4 additions and 4 deletions
|
|
@ -202,12 +202,12 @@ app.get('/s3/multipart/:uploadId', (req, res, next) => {
|
|||
|
||||
const parts = []
|
||||
|
||||
function listPartsPage (startAt) {
|
||||
function listPartsPage(startsAt = undefined) {
|
||||
client.send(new ListPartsCommand({
|
||||
Bucket: process.env.COMPANION_AWS_BUCKET,
|
||||
Key: key,
|
||||
UploadId: uploadId,
|
||||
PartNumberMarker: startAt,
|
||||
PartNumberMarker: startsAt,
|
||||
}), (err, data) => {
|
||||
if (err) {
|
||||
next(err)
|
||||
|
|
@ -216,15 +216,15 @@ app.get('/s3/multipart/:uploadId', (req, res, next) => {
|
|||
|
||||
parts.push(...data.Parts)
|
||||
|
||||
// continue to get list of all uploaded parts until the IsTruncated flag is false
|
||||
if (data.IsTruncated) {
|
||||
// Get the next page.
|
||||
listPartsPage(data.NextPartNumberMarker)
|
||||
} else {
|
||||
res.json(parts)
|
||||
}
|
||||
})
|
||||
}
|
||||
listPartsPage(0)
|
||||
listPartsPage()
|
||||
})
|
||||
|
||||
function isValidPart (part) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue