From e035e4fd4e3fc67bcdb4d4061b08d52be55c4f73 Mon Sep 17 00:00:00 2001 From: Leandro Date: Sun, 29 Mar 2015 21:06:53 -0300 Subject: [PATCH] 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. --- lib/storage-handler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/storage-handler.js b/lib/storage-handler.js index 2abd4ec..308bc54 100644 --- a/lib/storage-handler.js +++ b/lib/storage-handler.js @@ -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