node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป

bf

bf - a nodejs file descriptor abstraction that you can use with Buffer signatures.

Motivation

The stream API cannot seek easily, bl works fine, but load all your file in memory (that i cannot afford). The fs API is "good enough" yet i need the buffer signatures (readUInt & co) - hence bufferfile.

Build Status Coverage Status Version License

API/example

const bf = require('bf');

  //opens file descriptor
var file = new bf('somefile.txt', 'r');

  //read an int from fd
var int = file.readInt32BE(1024);


Extra signatures

  • buffer.close() - close the fd (!)

bufferfile provide an internal offset so you can

  • buffer.seek(pos)
  • all readXX are based on the internal offet (as default default)
  • all readXX are doubled with "consumeXX" signature that'll make the internal offset walk

Credits

  • 131 - author
  • Joshua Holbrook who gave me the package name
  • bl - good complementary