Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const files = process.argv.slice(2);
- function main(){
- if (!files.length) {
- console.log('Please provide at least one .uc file to decode.')
- return
- }
- files.forEach(async name => {
- await decodeFile(name);
- })
- }
- function decodeFile(name){
- try {
- if (fs.statSync(name+'.mp3').isFile()){
- console.log('Skip ' + name);
- return Promise.resolve();
- }
- } catch (e) {}
- const fileIn = fs.createReadStream(name);
- const fileOut = fs.createWriteStream(name+'.mp3');
- console.log('Processing: ' + name);
- fileIn.on('data',(chunk) => {
- fileOut.write(Buffer.from([...chunk].map(d=>d^0xa3)))
- });
- return new Promise((res, rej)=>{
- fileIn.on('end',() => {
- console.log('Finished: ' + name);
- fileOut.end();
- res();
- })
- });
- }
- main();
Add Comment
Please, Sign In to add comment