list-utf8-files
List all UTF-8-encoded files in a given directory
const listUtf8Files = ; /* ./dir/foo.txt: plain text file ./dir/node : binary file ./dir/dir : directory ./dir/bar.txt: empty file*/ async { await ; //=> Set {'/Users/example/dir/foo.txt', '/Users/example/dir/bar.txt'}};
Installation
npm install list-utf8-files
API
const listUtf8Files = ;
listUtf8Files(dir [, options])
dir: string
(directory path)
options: Object
(readdir-sorted
options)
Return: Promise<Set<string>>
The promise will be fulfilled with a Set
of strings — absolute paths of all UTF-8-encoded files included in the given directory.
Options are directly passed to the underlying readdir-sorted
to control encoding and order of results.
async { const iterator = await ; iteratornextvalue; //=> '/example/10.js' iteratornextvalue; //=> '/example/2a.js' iteratornextvalue; //=> '/example/2A.js'}; async { const iterator = await ; iteratornextvalue; //=> Buffer.from('/dirs/2A.js') iteratornextvalue; //=> Buffer('/dirs/2a.js') iteratornextvalue; //=> Buffer.from('/dirs/10.js')};
License
ISC License © 2017 - 2018 Shinnosuke Watanabe