-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
ERROR: getObject - RangeError: Invalid typed array length #1523
Comments
Is possible that this is due to exceeding buffer size, according to:
See nodejs/node#6560. |
@loretoparisi If you are using node.js, then you can download the object from S3 using a stream, instead of buffering it into memory. See http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/requests-using-stream-objects.html for details. If you are using the browser to download large files, then you would want to generate a presigned url and embed that in your page for the user to download. |
@chrisradek Thank you, I'm using within
and Ubuntu 16.0.4 LTS. I'm not doing specific buffering, I'm just using the libray as-it-is:
By the way I'm going to try the suggested examples:
And back here with results. |
@chrisradek I have tried this solution var file = fs.createWriteStream(options.filePath);
file.on('close', function(){
if(self.logger) self.logger.info("S3Dataset file download saved to %s", options.filePath );
return callback(null,done);
});
s3.getObject({ Key: documentKey }).createReadStream().on('error', function(err) {
if(self.logger) self.logger.error("S3Dataset download error key:%s error:%@", options.fileName, error);
return callback(error);
}).pipe(file); but nothing happens i.e. the |
The last approach I have tried was this one via var s3=self.s3Store.GetInstance();
var file = fs.createWriteStream(options.filePath);
s3.getObject({ Bucket: this._options.s3.Bucket, Key: documentKey })
.on('error', function(error) {
if(self.logger) self.logger.error("S3Dataset download error key:%s error:%@", options.fileName, error);
return callback(error);
})
.on('httpData', function(chunk) { file.write(chunk); })
.on('httpDone', function() {
file.end();
if(self.logger) self.logger.info("S3Dataset file download saved to %s", options.filePath );
return callback(null,done);
})
.send(); And this time it worked, so despite of I do not know why the
|
It looks like you got this working. Let us know if there are any additional details you can add regarding the original issue you encountered. |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
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. |
I get this error when downloading large files (2GB)
The error was
the stack trace is
The text was updated successfully, but these errors were encountered: