Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- // file read and renaming code here
- */
- // Zip files code below:
- try {
- let files_converted = fs.readdirSync(OUTPUT_DIRECTORY);
- let file_converstion_async_array = [];
- files_converted.forEach( (e , i) => {
- file_converstion_async_array.push( () => zip_Directory( `${OUTPUT_DIRECTORY}/${e}` , `${OUTPUT_DIRECTORY}/${e}.zip` ) );
- });
- console.log('Files are being zipped...');
- file_converstion_async_array.reduce( ( promise_chain , current_promise ) => {
- return promise_chain.then( p_results => {
- return current_promise().then( c_result => {
- // console.log('ZIPPED');
- });
- });
- } , Promise.resolve([]) ).then( () => {
- console.log('All Files have been zipped...');
- });
- } catch (err) {
- console.error(err);
- }
- // Finally render a new view
- res.render("finish", {
- name: req.body.outputPath
- });
Add Comment
Please, Sign In to add comment