mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Create folder if it doesn't exist when downloading files
This commit is contained in:
parent
de7e6c977f
commit
df6e0aca1b
@ -49,7 +49,6 @@ prebuildLessCache()
|
||||
generateMetadata()
|
||||
generateAPIDocs()
|
||||
downloadChromedriver()
|
||||
|
||||
dumpSymbols()
|
||||
.then(packageApplication)
|
||||
.then(packagedAppPath => {
|
||||
|
@ -1,4 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const syncRequest = require('sync-request')
|
||||
|
||||
module.exports = function (downloadURL, destinationPath) {
|
||||
@ -8,6 +11,7 @@ module.exports = function (downloadURL, destinationPath) {
|
||||
})
|
||||
|
||||
if (response.statusCode === 200) {
|
||||
fs.mkdirpSync(path.dirname(destinationPath))
|
||||
fs.writeFileSync(destinationPath, response.body)
|
||||
} else {
|
||||
throw new Error('Error downloading file. HTTP Status ' + response.statusCode + '.')
|
||||
|
Loading…
Reference in New Issue
Block a user