Skip to content

Commit

Permalink
updating aws-nodejs example listParts logic for resuming uploads (#5192)
Browse files Browse the repository at this point in the history

Co-authored-by: Mitchell Rhoads <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
  • Loading branch information
3 people authored Jun 17, 2024
1 parent 61223e9 commit a5bc28a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/aws-nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) {
Expand Down

0 comments on commit a5bc28a

Please sign in to comment.