-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
209fe3e
commit e74f40f
Showing
5 changed files
with
281 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
This is a Node.js module for calling | ||
[`getdents64`](https://linux.die.net/man/2/getdents64) on Linux from | ||
Javascript. | ||
|
||
You might want to use this instead of `fs.readdir` if [you have a | ||
directory containing many | ||
files](http://be-n.com/spw/you-can-list-a-million-files-in-a-directory-but-not-with-ls.html). | ||
|
||
API documentation is available | ||
[here](http://rawgit.davedoesdev.com/davedoesdev/getdents/master/docs/index.html). | ||
|
||
# Example | ||
|
||
List regular files in `/tmp`: | ||
|
||
``` javascript | ||
const fs = require('fs'), | ||
assert = require('assert'), | ||
Getdents = require('getdents').Getdents; | ||
|
||
fs.open('/tmp', 'r', async function (err, fd) | ||
{ | ||
assert.ifError(err); | ||
|
||
let getdents = new Getdents(1024 * 1024, fd); | ||
|
||
for await (let _ of getdents) | ||
{ | ||
if (getdents.type === Getdents.DT_REG) | ||
{ | ||
console.log(getdents.name); | ||
} | ||
} | ||
}); | ||
``` | ||
|
||
# Install | ||
|
||
``` bash | ||
npm install getdents | ||
``` | ||
|
||
# Licence | ||
|
||
[MIT](LICENCE) | ||
|
||
# Test | ||
|
||
``` bash | ||
grunt test | ||
``` | ||
|
||
# Coverage | ||
|
||
``` bash | ||
grunt coverage | ||
``` | ||
|
||
LCOV results are available | ||
[here](http://rawgit.davedoesdev.com/davedoesdev/getdents/master/coverage/lcov-report/index.html). | ||
|
||
Coveralls page is [here](https://coveralls.io/r/davedoesdev/getdents). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.