Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unzip issue Error: invalid signature: 0xe0ffd8ff #93

Open
Rahul-Jagga opened this issue Apr 21, 2016 · 1 comment
Open

unzip issue Error: invalid signature: 0xe0ffd8ff #93

Rahul-Jagga opened this issue Apr 21, 2016 · 1 comment

Comments

@Rahul-Jagga
Copy link

Rahul-Jagga commented Apr 21, 2016

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();
        });

});

@mhr3
Copy link

mhr3 commented Feb 27, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants