Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
fix: support older nodejs version by just using stat (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
umutuzgur committed Sep 6, 2019
1 parent a328e58 commit 12396d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ let fs = {
* @return {?string} returns the found path or null if the item was not found
*/
async walkDir (dir, recursive, callback) { //eslint-disable-line promise/prefer-await-to-callbacks
for (const item of await fs.readdir(dir, { withFileTypes: true })) {
const itemPath = path.join(dir, item.name);
const isDirectory = item.isDirectory();
for (const item of await fs.readdir(dir)) {
const itemPath = path.join(dir, item);
const isDirectory = (await fs.stat(itemPath)).isDirectory();
const found = await callback(itemPath, isDirectory); //eslint-disable-line promise/prefer-await-to-callbacks
if (found) {
return itemPath;
Expand Down

0 comments on commit 12396d7

Please sign in to comment.