Skip to content

Commit

Permalink
fs: refactoring declaratively with the fromAsync function
Browse files Browse the repository at this point in the history
- Refs: nodejs#51912
  • Loading branch information
sonsurim committed Aug 29, 2024
1 parent e70bd47 commit 07d075a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3115,10 +3115,7 @@ function glob(pattern, options, callback) {
// TODO: Use iterator helpers when available
(async () => {
try {
const res = [];
for await (const entry of new Glob(pattern, options).glob()) {
ArrayPrototypePush(res, entry);
}
const res = await Array.fromAsync(new Glob(pattern, options).glob());
callback(null, res);
} catch (err) {
callback(err);
Expand Down

0 comments on commit 07d075a

Please sign in to comment.