Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

check if path is directory using lstat instead of requiring trailing slash

DetachHead10d648c28d15
diff --git a/cli/src/index.js b/cli/src/index.js
index c58d99c2..6098949a 100644
--- a/cli/src/index.js
+++ b/cli/src/index.js
@@ -188,7 +188,7 @@ async function getInputFiles(paths) {
for (const path of paths) {
//allow paths ending in / of \ to get all files in that directory
- const files = path.endsWith('/') || path.endsWith('\\')
+ const files = (await fsp.lstat(path)).isDirectory()
? (await fsp.readdir(path)).map(file => join(path, file))
: [path];
for (const file of files) {