Files
ion-cli/anime/downloadVideo.js
T
2023-02-26 17:59:11 -05:00

20 lines
629 B
JavaScript

import { execFileSync } from 'child_process';
import { getJSON } from '../utils/JSON.js';
import chalk from 'chalk';
export default async function donwloadFromStream(url, newpath) {
try {
const vpath = await getJSON("vpath");
const command = `${vpath} ${url}`;
// start "C:\Program Files\VideoLAN\VLC\vlc.exe" url
console.log(chalk.green('done! Hit enter to watch!'));
console.log(command);
execFileSync(vpath, [url], {
stdio: ['ignore']
});
} catch (err) {
console.error(err);
console.log(chalk.red(`ERROR:\n${err.message}`));
}
}