getdents

4.0.0 • Public • Published

This is a Node.js module for calling getdents64 on Linux from Javascript.

You might want to use this instead of fs.readdir if you have a directory containing many files.

API documentation is available here.

Example

List regular files in /tmp:

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

npm install getdents

Licence

MIT

Test

grunt test

Coverage

grunt coverage

LCOV results are available here.

Coveralls page is here.

Readme

Keywords

Package Sidebar

Install

npm i getdents

Weekly Downloads

8

Version

4.0.0

License

MIT

Unpacked Size

1.91 MB

Total Files

72

Last publish

Collaborators

  • davedoesdev