Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek Mittal committed Feb 24, 2018
0 parents commit 381c335
Show file tree
Hide file tree
Showing 4,396 changed files with 553,832 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file added Sample CVs/BillGatesProfile.docx
Binary file not shown.
Binary file added Sample CVs/Chandu CV.docx
Binary file not shown.
Binary file added Sample CVs/JeffWeinerProfile.docx
Binary file not shown.
Binary file added Sample CVs/KevinSystromProfile.docx
Binary file not shown.
Binary file added Sample CVs/MichaelDellProfile.docx
Binary file not shown.
Binary file added Sample CVs/RandiZuckerbergProfile.docx
Binary file not shown.
Binary file added Sample CVs/Siddharth_Puri.pdf
Binary file not shown.
Binary file added Sample CVs/VaniKhuranaProfile.docx
Binary file not shown.
Binary file added Sample CVs/a.docx
Binary file not shown.
Binary file added Sample CVs/amupatiala.docx
Binary file not shown.
Binary file added Sample CVs/anjurani.docx
Binary file not shown.
Binary file added Sample CVs/ankursir.docx
Binary file not shown.
Binary file added Sample CVs/brain.docx
Binary file not shown.
Binary file added Sample CVs/cory.docx
Binary file not shown.
Binary file added Sample CVs/csr.docx
Binary file not shown.
Binary file added Sample CVs/csr1.docx
Binary file not shown.
Binary file added Sample CVs/gourab.docx
Binary file not shown.
Binary file added Sample CVs/jason.docx
Binary file not shown.
Binary file added Sample CVs/lella.pdf
Binary file not shown.
Binary file added Sample CVs/mandy.docx
Binary file not shown.
Binary file added Sample CVs/namaansir.docx
Binary file not shown.
Binary file added Sample CVs/pooja.docx
Binary file not shown.
Binary file added Sample CVs/rebecca.docx
Binary file not shown.
Binary file added Sample CVs/rimpy.docx
Binary file not shown.
Binary file added Sample CVs/sheshamnaiduProfile.docx
Binary file not shown.
Binary file added Sample CVs/~$maansir.docx
Binary file not shown.
Empty file added converted/abc1.txt.txt
Empty file.
72 changes: 72 additions & 0 deletions converter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
var fs = require('fs');
const express=require('express');
const mammoth = require('mammoth')
const start=require('./start')
const path = require('path')
cloudconvert = new (require('cloudconvert'))('OXBzggGenXcbU3fuZRKvxzRtLq0ZqyJkc-prJ5YPoged6TD629Fgl_tO6KwWsKJ9rTpr7CLE5lRuhzXNBlrogg');

function convert(file,new_name,format,res){
if(format=='doc'||format=='pdf'){
// create the process. see https://cloudconvert.com/apidoc#create
cloudconvert.createProcess({inputformat: format, outputformat: 'docx'}, function(err, conversionProcess) {

if(err) {
console.error('CloudConvert Process creation failed: ' + err);
} else {

// start the process. see https://cloudconvert.com/apidoc#create
conversionProcess.start({
outputformat: 'docx',
input: 'upload'
}, function (err, conversionProcess) {

if (err) {
console.error('CloudConvert Process start failed: ' + err);
} else {

// upload the input file. see https://cloudconvert.com/apidoc#upload
conversionProcess.upload(fs.createReadStream(path.join(__dirname,'./uploads/'+file)), null, function (err, conversionProcess) {

if (err) {
console.error('CloudConvert Process upload failed: ' + err);
} else {
// wait until the process is finished (or completed with an error)
conversionProcess.wait(function (err, conversionProcess) {
if (err) {
fs.unlinkSync(path.join(__dirname,'./uploads/'+file))
res.redirect('/')
console.error('CloudConvert Process failed: ' + err);
} else {
console.log('Done: ' + conversionProcess.data.message);

// download it
conversionProcess.download(fs.createWriteStream("./converted/"+new_name+".docx"), null, function (err, conversionProcess) {
if (err) {
console.error('CloudConvert Process download failed: ' + err);
} else {
console.log('Downloaded to converted');
fs.unlinkSync(path.join(__dirname,'./uploads/'+file))
start.check(new_name,res);
// fs.unlinkSync('./converted/' +new_name+'.docx')
// mammoth.convertToHtml({path: __dirname + "/converted1.docx"})
// .then(function(result){
// console.log(result.value);
// }) //end of mammoth
// .done();
}
});
}

});
}
});


}
});
}

});
}
}
module.exports={convert}
Loading

0 comments on commit 381c335

Please sign in to comment.