mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-11 16:26:20 +00:00
[CLI] Handle subdirectories without failing
This commit is contained in:
@@ -75,7 +75,7 @@ async function getInputFiles(paths) {
|
|||||||
|
|
||||||
for (const inputPath of paths) {
|
for (const inputPath of paths) {
|
||||||
const files = (await fsp.lstat(inputPath)).isDirectory()
|
const files = (await fsp.lstat(inputPath)).isDirectory()
|
||||||
? (await fsp.readdir(inputPath)).map((file) => path.join(inputPath, file))
|
? (await fsp.readdir(inputPath, {withFileTypes: true})).filter(dirent => dirent.isFile()).map(dirent => path.join(inputPath, dirent.name))
|
||||||
: [inputPath];
|
: [inputPath];
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user