Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to do multi-part download using aws sdk js? Is s3.getObject is multipart? #2043

Closed
ArjunMani opened this issue May 8, 2018 · 2 comments
Labels
guidance Question that needs advice or information.

Comments

@ArjunMani
Copy link

No description provided.

@chrisradek
Copy link
Contributor

@ArjunMani
There are 2 ways to performa a multi-part download form S3, both using the getObject method.

If an object was uploaded using a multi-part upload, then you can use the PartNumber field in the getObject parameters to request a specific part. You can tell if this is the case be calling headObject first and checking the PartsCount field in the response.

Alternatively, you can specify a range of bytes to download and make the getObject call multiple times. There's an example in the documentation

var params = {
Bucket: "examplebucket",
Key: "SampleFile.txt",
Range: "bytes=0-9"
};
s3.getObject(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
/*
data = {
AcceptRanges: "bytes",
ContentLength: 10,
ContentRange: "bytes 0-9/43",
ContentType: "text/plain",
ETag: ""0d94420ffd0bc68cd3d152506b97a9cc"",
LastModified: ,
Metadata: {
},
VersionId: "null"
}
*/
});

@srchase srchase added the guidance Question that needs advice or information. label Dec 6, 2018
@lock
Copy link

lock bot commented Sep 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants