An open API service indexing awesome lists of open source software.

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 })

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 })
```