« get me outta code hell

Unlink as well - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLiam <towerofnix@gmail.com>2017-05-31 14:19:47 -0300
committerLiam <towerofnix@gmail.com>2017-05-31 14:19:47 -0300
commit07626fe82986214d4ef56a5790d864c4bf19b27e (patch)
tree0bbc84ee1eefd242cbc35471c6c9dc59d182cb60
parentf5879e2eb3c86057f6f4a9e477c28ba8edf3824d (diff)
Unlink as well
-rw-r--r--play.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/play.js b/play.js
index 8833c89..bdee7f4 100644
--- a/play.js
+++ b/play.js
@@ -75,6 +75,7 @@ const sanitize = require('sanitize-filename')
 
 const writeFile = util.promisify(fs.writeFile)
 const readFile = util.promisify(fs.readFile)
+const unlink = util.promisify(fs.unlink)
 
 function promisifyProcess(proc, showLogging = true) {
 	return new Promise((resolve, reject) => {
@@ -168,7 +169,7 @@ async function loopPlay(fn) {
 			return await downloadNext()
 		}
 
-		await fs.unlink('./.temp-track')
+		await unlink('./.temp-track')
 
 		return wavFile
 	}
@@ -178,7 +179,7 @@ async function loopPlay(fn) {
 	while (wavFile) {
 		const nextPromise = downloadNext()
 		await playFile(wavFile)
-		await fs.unlink(wavFile)
+		await unlink(wavFile)
 		wavFile = await nextPromise
 	}
 }