mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
generate id outside of copy task
This commit is contained in:
12
renderer.js
12
renderer.js
@@ -5,8 +5,7 @@ const uuid = require('uuid');
|
||||
const {getDirPath, getDocPath} = require('./utils');
|
||||
|
||||
|
||||
function copyToTemp(texDocument, callback) {
|
||||
const id = uuid.v1();
|
||||
function copyToTemp(id, texDocument, callback) {
|
||||
const dirPath = getDirPath(id);
|
||||
|
||||
fs.mkdir(dirPath, (err) => {
|
||||
@@ -20,7 +19,7 @@ function copyToTemp(texDocument, callback) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
}
|
||||
callback(null, id);
|
||||
callback(null);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -42,7 +41,12 @@ function generateDoc(id, callback) {
|
||||
}
|
||||
|
||||
module.exports = (texDocument, callback) => {
|
||||
copyToTemp(texDocument, (err, id) => {
|
||||
const id = uuid.v1();
|
||||
copyToTemp(id, texDocument, (err) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
generateDoc(id, callback);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user