« get me outta code hell

http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/downloaders.js4
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())