We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ef2df1 commit a5f7a7dCopy full SHA for a5f7a7d
src/readdir-or-error.ts
@@ -2,10 +2,8 @@
2
// or the error that readdir() raised if not.
3
import { promises, readdirSync } from './fs.js'
4
const { readdir } = promises
5
-
6
export const readdirOrError = (path: string) =>
7
readdir(path).catch(er => er as NodeJS.ErrnoException)
8
9
export const readdirOrErrorSync = (path: string) => {
10
try {
11
return readdirSync(path)
0 commit comments