Comparing version 1.0.2 to 1.0.3
@@ -16,9 +16,15 @@ #!/usr/bin/env node | ||
: labelObject; | ||
await Promise.all(files.map(async (filePath) => { | ||
const vott = JSON.parse(await fsp.readFile(filePath, 'utf8')); | ||
const yolo = vott2yolo(vott, labels); | ||
const destName = `${path.basename(vott.asset.name, path.extname(vott.asset.name))}.txt`; | ||
const destPath = path.join(path.dirname(filePath), destName); | ||
return fsp.writeFile(destPath, yolo.join(EOL), 'utf8'); | ||
})); | ||
let processedFileCount = 0; | ||
const totalFileCount = files.length; | ||
while (processedFileCount < totalFileCount) { | ||
const chunk = files.slice(processedFileCount, processedFileCount + 500); | ||
await Promise.all(chunk.map(async (filePath) => { | ||
const vott = JSON.parse(await fsp.readFile(filePath, 'utf8')); | ||
const yolo = vott2yolo(vott, labels); | ||
const destName = `${path.basename(vott.asset.name, path.extname(vott.asset.name))}.txt`; | ||
const destPath = path.join(path.dirname(filePath), destName); | ||
return fsp.writeFile(destPath, yolo.join(EOL), 'utf8'); | ||
})); | ||
processedFileCount += chunk.length; | ||
} | ||
} catch (error) { | ||
@@ -25,0 +31,0 @@ console.error(error); |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "lib/index.js", | ||
@@ -15,0 +15,0 @@ "author": "Jean-Baptiste Martin", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4713
49