-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfiles.js
28 lines (23 loc) · 824 Bytes
/
files.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const fs= require("fs");
const path= require("path");
const pdfkit = require("pdfkit");
function createFiles(topicName, repoName, issuesList){
console.log(".........................");
console.log(issuesList);
console.log(topicName + " ..." + repoName );
dirPath= path.join(__dirname, topicName);
if(fs.existsSync(dirPath)==false){
fs.mkdirSync(dirPath);
}
//filePath= path.join(dirPath, repoName + ".json");
//fs.writeFileSync(filePath, JSON.stringify(issuesList));
//for creating PDFs
filePath= path.join(dirPath, repoName + ".pdf");
let jsonTextArr=JSON.stringify(issuesList);
let pdfDoc = new pdfkit();
pdfDoc.pipe(fs.createWriteStream(filePath));
pdfDoc.list(issuesList);
pdfDoc.moveDown(0.5);
pdfDoc.end();
}
module.exports = createFiles