You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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();
});
});
The text was updated successfully, but these errors were encountered:
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.
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();
}
});
});
}));
});
The text was updated successfully, but these errors were encountered: