lol
This commit is contained in:
parent
cf0494ac36
commit
59a274bc7a
17
index.js
17
index.js
@ -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]) {
|
if (!process.argv[2]) {
|
||||||
console.log('need a video');
|
console.log('need a video');
|
||||||
return;
|
return;
|
||||||
@ -30,7 +32,7 @@ async function exec(...args) {
|
|||||||
return item ? item.trim() : item;
|
return item ? item.trim() : item;
|
||||||
});
|
});
|
||||||
|
|
||||||
const dir = await tmp.dir({ prefix: 'mudl_', unsafeCleanup: true });
|
const dir = await fs.mkdir(TMP_DIR);
|
||||||
|
|
||||||
let files = [];
|
let files = [];
|
||||||
let inputType = null;
|
let inputType = null;
|
||||||
@ -158,4 +160,13 @@ async function exec(...args) {
|
|||||||
console.log('Finished everything, cleaning up...');
|
console.log('Finished everything, cleaning up...');
|
||||||
await dir.cleanup();
|
await dir.cleanup();
|
||||||
console.log('Done!');
|
console.log('Done!');
|
||||||
})().catch(console.error);
|
}
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
await thing();
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
await fs.rmdir(TMP_DIR, { recursive: true });
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
"name": "mudl",
|
"name": "mudl",
|
||||||
"description": "nothing yet",
|
"description": "nothing yet",
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"dependencies": {
|
|
||||||
"fs-extra": "^7.0.1",
|
|
||||||
"tmp-promise": "^1.0.5"
|
|
||||||
},
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"mudl": "index.js"
|
"mudl": "index.js"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user