readdir-withfiletypes
v1.0.2
Published
A ponyfill for fs.readdir(path, { withFileTypes: true })
Downloads
473
Maintainers
Readme
readdir-withFileTypes
A ponyfill for
fs.readdir(path, { withFileTypes: true })
Install
npm install --save readdir-withfiletypes
Usage
Before: No support for Node <10
import fs from "fs"
fs.readdir("./dir", { withFileTypes: true }, (err, dirents) => {
// ...
})
let dirents = readdirSync("./dir", { withFileTypes: true })
After: Support for Node <10
import { readdir, readdirSync } from "readdir-withFileTypes"
readdir("./dir", { withFileTypes: true }, (err, dirents) => {
// ...
})
let dirents = readdirSync("./dir", { withFileTypes: true })