https://github.com/jamiebuilds/readdir-withfiletypes
A ponyfill for fs.readdir(path, { withFileTypes: true })
https://github.com/jamiebuilds/readdir-withfiletypes
fs node nodejs polyfill ponyfill readdir readdirsync
Last synced: 2 months ago
JSON representation
A ponyfill for fs.readdir(path, { withFileTypes: true })
- Host: GitHub
- URL: https://github.com/jamiebuilds/readdir-withfiletypes
- Owner: jamiebuilds
- License: mit
- Created: 2019-03-20T21:36:47.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-20T21:42:19.000Z (about 6 years ago)
- Last Synced: 2025-03-12T21:02:51.047Z (3 months ago)
- Topics: fs, node, nodejs, polyfill, ponyfill, readdir, readdirsync
- Language: TypeScript
- Homepage:
- Size: 108 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# readdir-withFileTypes
> A ponyfill for `fs.readdir(path, { withFileTypes: true })`
## Install
```sh
npm install --save readdir-withfiletypes
```## Usage
**Before:** No support for Node <10
```js
import fs from "fs"fs.readdir("./dir", { withFileTypes: true }, (err, dirents) => {
// ...
})let dirents = readdirSync("./dir", { withFileTypes: true })
```**After:** Support for Node <10
```js
import { readdir, readdirSync } from "readdir-withFileTypes"readdir("./dir", { withFileTypes: true }, (err, dirents) => {
// ...
})let dirents = readdirSync("./dir", { withFileTypes: true })
```