mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-27 01:11:03 +00:00
16 lines
407 B
CoffeeScript
16 lines
407 B
CoffeeScript
url = require('url')
|
|
fs = require('fs')
|
|
server = require('../_server/server')
|
|
settings = require('../settings')
|
|
|
|
exports.download = (parameters, destination, callback, onProgress) ->
|
|
query = url.format(query: parameters)
|
|
downloadUrl = url.resolve(settings.get('urls.download'), query)
|
|
|
|
server.request
|
|
method: 'GET'
|
|
url: downloadUrl
|
|
pipe: fs.createWriteStream(destination)
|
|
, callback
|
|
, onProgress
|