refactor: destruct in parameters list
This commit is contained in:
parent
6d9bf1fefc
commit
0d94c2e589
1 changed files with 2 additions and 3 deletions
|
|
@ -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)))
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue