From e14e73d08703ada05070cd076e82912dd461bb65 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Tue, 30 May 2017 10:05:34 -0300 Subject: [PATCH] Uploads: Implement range for google storage read --- .../ufs/GoogleStorage/server.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/rocketchat-file-upload/ufs/GoogleStorage/server.js b/packages/rocketchat-file-upload/ufs/GoogleStorage/server.js index a6536d0a334..8a764caac73 100644 --- a/packages/rocketchat-file-upload/ufs/GoogleStorage/server.js +++ b/packages/rocketchat-file-upload/ufs/GoogleStorage/server.js @@ -83,9 +83,18 @@ export class GoogleStorageStore extends UploadFS.Store { * @param options * @return {*} */ - this.getReadStream = function(fileId, file/*, options = {}*/) { - // TODO range? - return this.bucket.file(this.getPath(file)).createReadStream(); + this.getReadStream = function(fileId, file, options = {}) { + const config = {}; + + if (options.start != null) { + config.start = options.start; + } + + if (options.end != null) { + config.end = options.end; + } + + return this.bucket.file(this.getPath(file)).createReadStream(config); }; /**