1.0.5 • Published 5 years ago

fs-readdir-sync-with-file-types v1.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

fs-readdir-sync-with-file-types License NPM version Dependency Status Build Status Coverage Status

Node.js v10.10.0 fs.readdirSync ponyfill of withFileTypes option.

options.withFileTypes is always set to true and result contain objects similar to fs.Dirent.

Install

npm i fs-readdir-sync-with-file-types

API

  • path <string> | <Buffer> | <URL>

Returns: <fs.Dirent[]>

Example:

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

License

MIT

1.0.5

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago