fadvise

1.0.0 • Public • Published

Native Node.js bindings for the posix_fadvise() function on Linux

Usage:

const fadvise = require('fadvise');
const fs = require('fs');

let fd = fs.openSync('./test.tmp', 'a');
fs.writeSync(fd, 'hundreds of megabytes');
fs.fsync(fd, function () {
  fadvise.posix_fadvise(fd, 0, 0, fadvise.POSIX_FADV_DONTNEED);
  fs.closeSync(fd);
});

In the example above, top and nocache's cachestats test.tmp should indicate 0 (additional) pages in buffers/cache.

See posix_fadvise(7) for details.

Package Sidebar

Install

npm i fadvise

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

5.55 kB

Total Files

5

Last publish

Collaborators

  • jimbly