Open piyushdhamecha opened 1 year ago
I am experiencing the same phenomenon.
Hi, i have the same problem
Hello, I'm also facing the same issue. Is there any plan on fixing this issue ? Thanks
Does this PR fix the issue for you, guys? https://github.com/anacronw/multer-s3/pull/204/files
Does this PR fix the issue for you, guys? https://github.com/anacronw/multer-s3/pull/204/files
Need to check, @HofmT have you checked?
@piyushdhamecha I just tried it, the callback is now returning the proper value for currentSize
Here's an extract from my debugging logs with the fix:
Before creating an upload object
progress {
loaded: 4539430,
total: undefined,
part: 2,
Key: 'avatars/7wmT5UFW7-lCeOjMU0_VAr~ONjJsR6V0Vkrsp~bMcQm2ATxs24.jpg',
Bucket: 'plural-development-files'
}
progress {
loaded: 9782310,
total: undefined,
part: 1,
Key: 'avatars/7wmT5UFW7-lCeOjMU0_VAr~ONjJsR6V0Vkrsp~bMcQm2ATxs24.jpg',
Bucket: 'plural-development-files'
}
currentSize 9782310
This is my modified code from index.js
:
upload.on('httpUploadProgress', function (ev) {
console.log("progress ", ev);
currentSize = (ev.total) ? ev.total : ev.loaded
})
util.callbackify(upload.done.bind(upload))(function (err, result) {
if (err) return cb(err)
console.log('currentSize ', currentSize);
cb(null, {
size: currentSize,
bucket: opts.bucket,
key: opts.key,
acl: opts.acl,
contentType: opts.contentType,
contentDisposition: opts.contentDisposition,
contentEncoding: opts.contentEncoding,
storageClass: opts.storageClass,
serverSideEncryption: opts.serverSideEncryption,
metadata: opts.metadata,
location: result.Location,
etag: result.ETag,
versionId: result.VersionId
})
})
@HofmT nice solution, will wait for PR to be merged and update with the latest package and test it, And thanks for the solution
Does this PR fix the issue for you, guys? https://github.com/anacronw/multer-s3/pull/204/files
This PR works, and you can use it by running the following command to install the specific commit: npm install anacronw/multer-s3#b0f0ffb55c1642b699a032a48c3bc1b942b6a10e This should fix the issue. Thanks @HofmT
Hi guys,
I am facing one issue.
I have created middleware with multer and multer s3 to upload objects to aws s3
all seems working fine, objects are uploading properly, but in some of the files the size is 0
I investigated and found that if the file size is more than 5MB then it returns a 0
Middleware code
uploadAwsS3.js
Router