tururu
Version:
naruto sadness and sorrow funk remix in the terminal
39 lines (30 loc) • 944 B
JavaScript
const exect = require('child_process').exec;
const path = require('path');
const fs = require('fs');
const mainPath = path.dirname(fs.realpathSync(__filename));
const soundPath = path.join(mainPath, './tururu');
const faustaoErrou = function (){
const linuxcmd = 'paplay '+soundPath+'.ogg';
const windowscmd = path.join(mainPath, './forWindows.vbs')+' '+soundPath+'.mp3';
const maccmd = 'afplay '+soundPath+'.mp3';
const platform = process.platform;
if(platform === 'linux'){
return exec(linuxcmd);
}
else if(platform === 'win32'){
return exec(windowscmd);
} else if(platform === 'darwin'){
return exec(maccmd);
}
function exec(cmd){
return exect(cmd, function (error, stdout, stderr) {
if(error)
console.error(error);
});
}
}
module.exports = faustaoErrou;
if (!module.parent) {
faustaoErrou();
}