diff options
author | Florrie <towerofnix@gmail.com> | 2019-05-22 19:29:08 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-05-22 19:29:08 -0300 |
commit | 77bae19bb60e8a2dd6afd4086b2e1a6b06e129e4 (patch) | |
tree | 67dce3323c8c808a2461a98f721d1b5c374143f4 /list-cache.js | |
parent | a9f07edbfc6ea3f693ac3149e39616949671d650 (diff) |
Oragnize cached downloads much better!
This means mtui won't be able to access tracks that were downloaded before, but oh well. It also means we get to get rid of js-base64 as a dependency!
Diffstat (limited to 'list-cache.js')
-rw-r--r-- | list-cache.js | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/list-cache.js b/list-cache.js deleted file mode 100644 index 71dbbcc..0000000 --- a/list-cache.js +++ /dev/null @@ -1,33 +0,0 @@ -const { Base64 } = require('js-base64') -const fs = require('fs') -const util = require('util') -const downloaders = require('./downloaders') -const ansi = require('./tui-lib/util/ansi') - -const readdir = util.promisify(fs.readdir) - -async function main(args) { - const dlPath = downloaders.rootCacheDir - const type = args[0] || null - - async function list(dir) { - console.log(await readdir(dir)) - } - - if (!type) { - console.log('No type specified. Pass one of the following as an argument:', (await readdir(dlPath)).join(', ')) - return - } - - console.log(`${ansi.setAttributes([ansi.A_BRIGHT])}Downloads of type "${type}"${ansi.resetAttributes()}`) - for (const entry of await readdir(dlPath + '/' + type)) { - const files = await readdir(`${dlPath}/${type}/${entry}`) - console.log(` ${Base64.decode(entry)}: ${ansi.setAttributes([ansi.A_BRIGHT])}${files.join(', ')} ${ansi.resetAttributes()}${ansi.setAttributes([ansi.A_DIM])}(${type}/${entry})${ansi.resetAttributes()}`) - } -} - -module.exports = main - -if (require.main === module) { - main(process.argv.slice(2)).catch(err => console.error(err)) -} |