Expose file size on success callback

Just expose the file size through the file object that later will be sent as succes callback attribute (line 160). This way if somebody needs to persist the file metadata in another model now it will exist the whole basic pack: Container, Name, Type and now Size.
This commit is contained in:
Leandro 2015-03-29 21:06:53 -03:00
parent bddb69e3fc
commit e035e4fd4e
1 changed files with 1 additions and 0 deletions

View File

@ -135,6 +135,7 @@ exports.upload = function (provider, req, res, options, cb) {
if (maxFileSize) {
part.on('data', function (buffer) {
fileSize += buffer.length;
file.size = fileSize;
if (fileSize > maxFileSize) {
// We are missing some way to tell the provider to cancel upload/multipart upload of the current file.
// - s3-upload-stream doesn't provide a way to do this in it's public interface