Skip to content

davedoesdev/getdents

Repository files navigation

getdents   Build Status Coverage Status NPM version

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.

About

Call getdents64 from Javscript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published