fixes asynchronous error

pull/64/head
macniel 2025-11-01 10:45:01 +01:00
parent b69511f93a
commit 026f222718
1 changed files with 14 additions and 14 deletions

View File

@ -68,8 +68,7 @@ const convert = function (from, to, ofType, overwrite = true) {
} else {
console.debug("processing file", join(source, file))
let originalSource = JSON.parse(readFileSync(join(source, file), {encoding: "utf8"}));
let id = randomID("DSA_4-1" + TYPE + originalSource.name.trim());
randomID("DSA_4-1" + TYPE + originalSource.name.trim()).then(id => {
let targetSource = {
_id: id,
@ -83,6 +82,7 @@ const convert = function (from, to, ofType, overwrite = true) {
let target = JSON.stringify(targetSource, null, 2);
let newFileName = "./" + join(DEST, id + ".json");
writeFileSync(newFileName, target, {encoding: "utf8"});
})
}
});
}