diff --git a/lib/ofac/update.js b/lib/ofac/update.js index 83e9b7a4..39738853 100644 --- a/lib/ofac/update.js +++ b/lib/ofac/update.js @@ -56,13 +56,12 @@ const promiseGetEtag = ({ url }) => request.end() }) -const download = _.curry((dstDir, source) => { - const {name, url: sourceUrl} = source +const download = _.curry((dstDir, { name, url }) => { const dstFile = path.join(dstDir, name + '.xml') const file = fs.createWriteStream(dstFile) return new Promise((resolve, reject) => { - const request = https.get(sourceUrl, response => { + const request = https.get(url, response => { response.pipe(file) file.on('finish', () => file.close(() => resolve(dstFile))) })