Skip to content

Commit

Permalink
Add path seperator
Browse files Browse the repository at this point in the history
This avoid permission issues for users that cannot create files in "/",  like "/tmpXXXX". It will generate "/tmp/XXX" instead.

Ref: #62 d696940
Co-authored-By: Rachid Tarsimi <[email protected]>
  • Loading branch information
srl295 and rtarsimi committed Sep 30, 2021
1 parent a57877d commit 4b0ee36
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion myFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const os = require('os')
const path = require('path')
const fs = require('fs')
const { sep } = require('path')

function getFetcher (u) {
if (u.protocol === 'https:') return require('https')
Expand All @@ -29,7 +30,7 @@ function myFetch (fullUrl) {
} else if (res.statusCode !== 200) {
return reject(Error(`Bad status code ${res.statusCode}`))
}
const tmpd = fs.mkdtempSync(os.tmpdir())
const tmpd = fs.mkdtempSync(`${os.tmpdir()}${sep}`)
const tmpf = path.join(tmpd, 'icu-download.zip')
let gotSoFar = 0
console.dir(tmpd)
Expand Down

0 comments on commit 4b0ee36

Please sign in to comment.