node-unzip icon indicating copy to clipboard operation
node-unzip copied to clipboard

unzip issue Error: invalid signature: 0xe0ffd8ff

Open Rahul-Jagga opened this issue 9 years ago • 1 comments

The problem is when i upload docs,ppt,pdf files its working fine but when i upload jpg , png files it generates the Error: invalid signature: 0xe0ffd8ff. If there is anybody to help use then contact us and help as soon as thanks advance. parse

this is my index.js file where i put my function for file conversion : // callback for upload files app.post("/upload",function(req,res){ console.log("file name="+file_name); console.log(req.body); fs.createReadStream(file_path).pipe(cloudconvert.convert({ inputformat: file_name.split('.').pop(), outputformat: 'jpg', /* converteroptions: { quality : 75, }/ }).on('error', function(err) { console.error('Failed: ' + err); //alert('Failed:'+err +'please refresh....'); }).on('finished', function(data) { console.log('Done: ' + data.message); //alert('Done:' + data.message + 'continue....'); this.pipe(fs.createWriteStream('public/upload/'+file_name.split('.').shift()+'.zip')); }).on('downloaded', function(destination) { console.log('Downloaded to: ' + destination.path); fs.mkdirSync('public/upload/'+file_name.split(".").shift()); var read=fs.createReadStream(destination.path); console.log('read directory to: ' + read); read.pipe(unzip.Extract({ path: 'public/upload/'+file_name.split(".").shift()+'/' })); console.log(file_name.split(".").shift()); read.on('end',function(){ fs.readdir('public/upload/'+file_name.split(".").shift()+'/', function(err, files) {
//
*****DSC Error console.log("lenght"+files.length) if(!err){ for(var i=0;i<files.length;i++){ files[i]='upload/'+file_name.split('.').shift()+'/'+files[i]; console.log(files[i]); } res.send({'slides':files}); res.end(); } }); }); }));

    res.setTimeout(120000*10, function(){
        console.log('Request has timed out.');
            res.send({'status':408});
            res.end();
        });

});

Rahul-Jagga avatar Apr 21 '16 06:04 Rahul-Jagga

If you're still having this issue, I've published unzip-stream which should solve it.

mhr3 avatar Feb 27 '17 01:02 mhr3