enable range requests on files via ?range=m-n query string.

This commit is contained in:
Shane Kilkelly 2016-05-17 16:59:47 +01:00
parent af78e893f9
commit 4f533147b1

View file

@ -42,6 +42,11 @@ module.exports = FileStoreHandler =
method : "get"
uri: "#{@_buildUrl(project_id, file_id)}#{queryString}"
timeout:fiveMinsInMs
headers: {}
if query? and query['range']?
rangeText = query['range']
if rangeText && rangeText.match? && rangeText.match(/\d+-\d+/)
opts.headers['range'] = "bytes=#{query['range']}"
readStream = request(opts)
readStream.on "error", (err) ->
logger.err {err, project_id, file_id, query}, "error in file stream"