Skip to content

Bun Glob scan have different order than using node #10112

Answered by truongan07
huyhoang160593 asked this question in Q&A
Discussion options

You must be logged in to vote
  • I think Bun's Glob will asynchronous scan to get high performance task and return a promise. You can sort files in an array
let list = [];

for await (const path of globalThis.Bun.Glob('./*/*').scan({ absolute: true })) list.push(path);
list = list.sort((find, string) => string.toString().trim().toLocaleLowerCase().localeCompare(find.toString().trim().toLocaleLowerCase())).reverse();

console.log(list);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Jarred-Sumner
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants