Effect-TS / effect

An ecosystem of tools to build robust applications in TypeScript
https://effect.website
MIT License
7.59k stars 242 forks source link

FileSystem.glob #2485

Open jessekelly881 opened 7 months ago

jessekelly881 commented 7 months ago

It would be nice to have an @effect/platform native file glob similar to https://www.npmjs.com/package/glob that could be used w/ any FileSystem implementation.

(Bun has a built in implementation https://bun.sh/docs/api/glob)

Nicholaiii commented 6 months ago

+1 to this. Untill then (BYO error handling):

import fg from 'fast-glob'

export const glob = (path: string) => (cwd: string) => Effect.tryPromise({
  try: () => fg(path, { cwd }),
  catch: (cause) => createFilesystemError(`Glob Error`, { cause })
})