readdir-withfiletypes
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i readdir-withfiletypes

Weekly Downloads

567

Version

1.0.2

License

MIT

Unpacked Size

7.36 kB

Total Files

7

Last publish

Collaborators

  • thejameskyle