diff options
author | liam4 <towerofnix@gmail.com> | 2017-05-30 20:16:56 +0000 |
---|---|---|
committer | liam4 <towerofnix@gmail.com> | 2017-05-30 20:16:56 +0000 |
commit | 2eb20cf1cb32a89da1aea32a3029a72cc401d01d (patch) | |
tree | e8654f98fbbe27b32e36598746bbc2ea67cfb272 | |
parent | 865d681f4660e380942698b92e2d00182a1c8728 (diff) |
Use mz/fs instead of fs-promise
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | play.js | 12 | ||||
-rw-r--r-- | yarn.lock | 30 |
3 files changed, 9 insertions, 35 deletions
diff --git a/package.json b/package.json index 0d2a017..33069a4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "dependencies": { "cheerio": "^1.0.0-rc.1", - "fs-promise": "^2.0.3", + "mz": "^2.6.0", "node-fetch": "^1.7.0", "sanitize-filename": "^1.6.1" } diff --git a/play.js b/play.js index 8032378..c1f24e3 100644 --- a/play.js +++ b/play.js @@ -66,7 +66,7 @@ 'use strict' -const fsp = require('fs-promise') +const fs = require('mz/fs') const fetch = require('node-fetch') const sanitize = require('sanitize-filename') const { spawn } = require('child_process') @@ -152,7 +152,7 @@ async function loopPlay(fn) { const res = await fetch(href) const buffer = await res.buffer() - await fsp.writeFile('./.temp-track', buffer) + await fs.writeFile('./.temp-track', buffer) try { await convert('./.temp-track', wavFile) @@ -163,7 +163,7 @@ async function loopPlay(fn) { return await downloadNext() } - await fsp.unlink('./.temp-track') + await fs.unlink('./.temp-track') return wavFile } @@ -173,7 +173,7 @@ async function loopPlay(fn) { while (wavFile) { const nextPromise = downloadNext() await playFile(wavFile) - await fsp.unlink(wavFile) + await fs.unlink(wavFile) wavFile = await nextPromise } } @@ -296,7 +296,7 @@ async function processArgv(argv, handlers) { } } -fsp.readFile('./playlist.json', 'utf-8') +fs.readFile('./playlist.json', 'utf-8') .then(plText => JSON.parse(plText)) .then(async playlist => { let sourcePlaylist = playlist @@ -316,7 +316,7 @@ fsp.readFile('./playlist.json', 'utf-8') // Opens a separate playlist file. // This sets the source playlist. - const openedPlaylist = JSON.parse(await fsp.readFile(util.nextArg(), 'utf-8')) + const openedPlaylist = JSON.parse(await fs.readFile(util.nextArg(), 'utf-8')) sourcePlaylist = openedPlaylist curPlaylist = openedPlaylist }, diff --git a/yarn.lock b/yarn.lock index d610ff6..5fb5fcb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6,7 +6,7 @@ version "6.0.73" resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.73.tgz#85dc4bb6f125377c75ddd2519a1eeb63f0a4ed70" -any-promise@^1.0.0, any-promise@^1.3.0: +any-promise@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" @@ -84,26 +84,6 @@ entities@^1.1.1, entities@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" -fs-extra@^2.0.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-2.1.2.tgz#046c70163cef9aad46b0e4a7fa467fb22d71de35" - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - -fs-promise@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/fs-promise/-/fs-promise-2.0.3.tgz#f64e4f854bcf689aa8bddcba268916db3db46854" - dependencies: - any-promise "^1.3.0" - fs-extra "^2.0.0" - mz "^2.6.0" - thenify-all "^1.6.0" - -graceful-fs@^4.1.2, graceful-fs@^4.1.6: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - htmlparser2@^3.9.1: version "3.9.2" resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.9.2.tgz#1bdf87acca0f3f9e53fa4fcceb0f4b4cbb00b338" @@ -131,12 +111,6 @@ isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" -jsonfile@^2.1.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" - optionalDependencies: - graceful-fs "^4.1.6" - lodash@^4.15.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -204,7 +178,7 @@ string_decoder@~1.0.0: dependencies: safe-buffer "^5.0.1" -thenify-all@^1.0.0, thenify-all@^1.6.0: +thenify-all@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" dependencies: |