Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

readdir-withfiletypes

thejameskyle271MIT1.0.2TypeScript support: included

A ponyfill for fs.readdir(path, { withFileTypes: true })

ponyfill, polyfill, fs, readdir, read, dir, directory, withfiletypes, with, file, types, dirent, dirents, entries, stat, stats

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