mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-12 00:37:19 +00:00
Merge pull request #923 from DetachHead/dev
This commit is contained in:
@@ -183,9 +183,13 @@ function progressTracker(results) {
|
|||||||
return tracker;
|
return tracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkInputFilesValid(files) {
|
async function getInputFiles(paths) {
|
||||||
const validFiles = [];
|
const validFiles = [];
|
||||||
|
|
||||||
|
for (const path of paths) {
|
||||||
|
const files = (await fsp.lstat(path)).isDirectory()
|
||||||
|
? (await fsp.readdir(path)).map(file => join(path, file))
|
||||||
|
: [path];
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
try {
|
try {
|
||||||
await fsp.stat(file);
|
await fsp.stat(file);
|
||||||
@@ -202,12 +206,13 @@ async function checkInputFilesValid(files) {
|
|||||||
|
|
||||||
validFiles.push(file);
|
validFiles.push(file);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return validFiles;
|
return validFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function processFiles(files) {
|
async function processFiles(files) {
|
||||||
files = await checkInputFilesValid(files);
|
files = await getInputFiles(files);
|
||||||
|
|
||||||
const parallelism = cpus().length;
|
const parallelism = cpus().length;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user