bajo-extra 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,10 @@ async function download (url, opts = {}, extra = {}) {
20
20
  const file = path.resolve(increment(`${extra.dir}/${extra.fileName}`, { fs: true }))
21
21
  const writer = fs.createWriteStream(file)
22
22
  const { headers, body, ok, status } = await fetch(url, opts, merge({}, extra, { rawResponse: true }))
23
- if (!ok) throw error('Getting %s status', status)
23
+ if (!ok) {
24
+ fs.removeSync(file)
25
+ throw error('Getting %s status', status)
26
+ }
24
27
  const total = headers['content-length'] ?? 0
25
28
  const data = Readable.fromWeb(body)
26
29
  let length = 0
@@ -7,7 +7,7 @@ async function download ({ path, args }) {
7
7
 
8
8
  let dest
9
9
  try {
10
- dest = await download(url, null, { spin, spinText })
10
+ dest = await download(url, undefined, { spin, spinText })
11
11
  } catch (err) {
12
12
  spin.fatal('Error: %s', err.message)
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajo-extra",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Extra package for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {