This commit is contained in:
notgne2 2021-01-27 00:23:01 -07:00
parent cf0494ac36
commit 59a274bc7a
No known key found for this signature in database
GPG Key ID: BB661E172B42A7F8
2 changed files with 15 additions and 8 deletions

View File

@ -20,7 +20,9 @@ async function exec(...args) {
});
}
(async () => {
const TMP_DIR = `/tmp/mudl_${Math.random().toString(36).substring(7)}`;
async function thing() {
if (!process.argv[2]) {
console.log('need a video');
return;
@ -30,7 +32,7 @@ async function exec(...args) {
return item ? item.trim() : item;
});
const dir = await tmp.dir({ prefix: 'mudl_', unsafeCleanup: true });
const dir = await fs.mkdir(TMP_DIR);
let files = [];
let inputType = null;
@ -158,4 +160,13 @@ async function exec(...args) {
console.log('Finished everything, cleaning up...');
await dir.cleanup();
console.log('Done!');
})().catch(console.error);
}
(async () => {
try {
await thing();
} catch (err) {
console.error(err);
await fs.rmdir(TMP_DIR, { recursive: true });
}
})();

View File

@ -2,10 +2,6 @@
"name": "mudl",
"description": "nothing yet",
"version": "1.0.2",
"dependencies": {
"fs-extra": "^7.0.1",
"tmp-promise": "^1.0.5"
},
"bin": {
"mudl": "index.js"
},