https://github.com/coderaiser/fs-readdir-sync-with-file-types
fs.readdirSync withFileTypes ponyfill https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_fs_readdirsync_path_options
https://github.com/coderaiser/fs-readdir-sync-with-file-types
fs-readdir-sync nodejs ponyfill with-file-types
Last synced: 8 months ago
JSON representation
fs.readdirSync withFileTypes ponyfill https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_fs_readdirsync_path_options
- Host: GitHub
- URL: https://github.com/coderaiser/fs-readdir-sync-with-file-types
- Owner: coderaiser
- License: mit
- Created: 2018-10-09T13:58:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T09:22:29.000Z (almost 7 years ago)
- Last Synced: 2025-07-20T19:47:30.930Z (8 months ago)
- Topics: fs-readdir-sync, nodejs, ponyfill, with-file-types
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
fs-readdir-sync-with-file-types [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
=========
Node.js v10.10.0 [fs.readdirSync](https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_fs_readdirsync_path_options) [ponyfill](https://ponyfill.com) of `withFileTypes` option.
`options.withFileTypes` is always set to true and result contain objects similar to [fs.Dirent](https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_class_fs_dirent).
## Install
```
npm i fs-readdir-sync-with-file-types
```
## API
- `path` ` | | `
Returns:
Example:
```js
const readdirSync = require('fs-readdir-sync-with-file-types');
readdirSync('.');
// returns on node v10.10
Dirent { name: 'LICENSE', [Symbol(type)]: 1 },
Dirent { name: 'README.md', [Symbol(type)]: 1 },
Dirent { name: 'index.js', [Symbol(type)]: 1 },
// returns on node < v10.10
{ name: 'LICENSE',
isBlockDevice: [Function: bound ],
isCharacterDevice: [Function: bound ],
isDirectory: [Function: bound ],
isFIFO: [Function: bound ],
isFile: [Function: bound ],
isSocket: [Function: bound ],
isSymbolicLink: [Function: bound ] },
{ name: 'README.md',
isBlockDevice: [Function: bound ],
isCharacterDevice: [Function: bound ],
isDirectory: [Function: bound ],
isFIFO: [Function: bound ],
isFile: [Function: bound ],
isSocket: [Function: bound ],
isSymbolicLink: [Function: bound ] },
{ name: 'index.js',
isBlockDevice: [Function: bound ],
isCharacterDevice: [Function: bound ],
isDirectory: [Function: bound ],
isFIFO: [Function: bound ],
isFile: [Function: bound ],
isSocket: [Function: bound ],
isSymbolicLink: [Function: bound ] }
```
## Related
- [fs-copy-file](https://github.com/coderaiser/fs-copy-file "fs-copy-file") - Asynchronously copies src to dest.
- [fs-copy-file-sync](https://github.com/coderaiser/fs-copy-file-sync "fs-copy-file-sync") - Synchronously copies src to dest.
- [fs-readdir-with-file-types](https://github.com/coderaiser/fs-readdir-with-file-types "fs-readdir-with-file-types") - Asynchronousely read directory with file types.
## License
MIT
[NPMIMGURL]: https://img.shields.io/npm/v/fs-readdir-sync-with-file-types.svg?style=flat&longCache=true
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/fs-readdir-sync-with-file-types/master.svg?style=flat&longCache=true
[DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/fs-readdir-sync-with-file-types.svg?style=flat&longCache=true
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat&longCache=true
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/fs-readdir-sync-with-file-types/badge.svg?branch=master&service=github
[NPMURL]: https://npmjs.org/package/fs-readdir-sync-with-file-types "npm"
[BuildStatusURL]: https://travis-ci.org/coderaiser/fs-readdir-sync-with-file-types "Build Status"
[DependencyStatusURL]: https://david-dm.org/coderaiser/fs-readdir-sync-with-file-types "Dependency Status"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[CoverageURL]: https://coveralls.io/github/coderaiser/fs-readdir-sync-with-file-types?branch=master