alirezakay / nodejs-media-converter Goto Github PK
View Code? Open in Web Editor NEWConvert your multimedia in Node.JS as easy as you like (audio, image, video) with compression
Home Page: https://www.npmjs.com/package/media-converter
Convert your multimedia in Node.JS as easy as you like (audio, image, video) with compression
Home Page: https://www.npmjs.com/package/media-converter
Ive been trying to convert a series of images. PNG to JPG and I seem to run into an issue where the output media is outputted to the intended path and the path of the code main script:
/**
* Reads PNG File(s) then converts to JPG
*/
function ArrayConvertPNGtoJPG() {
// PNG to JPG Spinner
const pngTOjpgSpinner = ora("WARNING: Attempting Conversion of PNG to JPG").start();
const directoryPath = path.join(__dirname, './Input');
setTimeout(() => {
fs.readdir(directoryPath, function (err, files) {
//handling error
if (err) {
return console.log('Unable to scan directory: ' + err);
}
for (let i = 0; i < files.length; i++) {
const input = "./Input/" + files[i];
const output = `./Converted/${files[i].slice(0, -4)}.jpg`
convert(input, output, (err) => {
if (!err){
pngTOjpgSpinner.succeed("SUCCESS: ".green + input.green + " Converted to ".green + output.green);
} else {
pngTOjpgSpinner.fail("ERROR: Unable to convert file: " + input + " to a JPG");
}
});
}
});
}, 2000);
}
If you could help me find a solution it would be helpful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.