diff options
author | liam4 <towerofnix@gmail.com> | 2017-06-12 12:21:44 +0000 |
---|---|---|
committer | liam4 <towerofnix@gmail.com> | 2017-06-12 12:21:44 +0000 |
commit | bafe90fb6a0c7fcb911df537ef448bbbb9ecf457 (patch) | |
tree | 7ec3e5c46b7c1bc2e88154e4265e75a7e80283d4 /src | |
parent | ceb4c5959d1a50574029c39252248874ed0fa160 (diff) |
Keep downloaded filename in HTTP downloader
Diffstat (limited to 'src')
-rw-r--r-- | src/downloaders.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/downloaders.js b/src/downloaders.js index 28dab92..ad322fa 100644 --- a/src/downloaders.js +++ b/src/downloaders.js @@ -2,6 +2,7 @@ const fs = require('fs') const fetch = require('node-fetch') const promisifyProcess = require('./promisify-process') const tempy = require('tempy') +const path = require('path') const { spawn } = require('child_process') const { promisify } = require('util') @@ -10,7 +11,8 @@ const writeFile = promisify(fs.writeFile) function makeHTTPDownloader() { return function(arg) { - const out = tempy.file() + const dir = tempy.directory() + const out = dir + '/' + path.basename(arg) return fetch(arg) .then(response => response.buffer()) |