binreader
v0.0.6
Published
A basic binary reader for Node.js
Downloads
15
Maintainers
Readme
binreader
A basic buffered binary reader for Node.js.
Basic Examples
const BinReader = require('binreader');
const reader = new BinReader({
filename: 'hello.dat'
});
reader.seek(512);
const x = reader.nextInt();
API
constructor(options)
:options
contains properties:filename
,byteOrder
(optional),bufferSize
(optional)Number:
length
: returns the length of the fileBoolean:
canRead
: returns true if the stream is not at the endNumber:
nextLong()
: reads signed 64 bit number. note that the max precision in javascript is only 53 bits!Number:
nextULong()
: reads an unsigned 64 bit number. note that the max precision in javascript is only 53 bits!Number:
nextInt()
: reads a 32 bit signed numberNumber:
nextUInt()
: reads a 32 bit unsigned numberNumber:
nextShort()
: reads a 16 bit signed numberNumber:
nextUShort()
: reads a 16 bit unsigned numberNumber:
nextByte()
: reads a 8 bit unsigned numberNumber:
nextSByte()
: reads a 8 bit signed number