So I found a parser for a file I need to parse on github however it's broken in recent versions of node, After some digging I found something saying that in v10.0.0 there was no core support for unsigned 64 big endian integers. I have very little experience with all this buffer binary parsing stuff so I've been having a hard time figuring it out, the error I get is this:
throw new ERR_OUT_OF_RANGE(type || 'offset',
^
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 142. Received 178555087
It's using the binary-parser
npm package and the place it's crashing is this:
const HeaderChunk = new Parser()
.endianess('little')
.skip(20)
.int8('major')
.skip(1)
.int8('minor')
.skip(1)
.int8('patch')
.skip(1)
.int32('build')
.int32('version_length')
.string('version', { length: 'version_length', stripNull: 'true'})
.int32('unknown1')
.int32('map_length')
.string('map', { length: 'map_length', stripNull: 'true'})
.int32('unknow2')
.int32('unknow3')
.int32('unknow4')
.buffer('buffer', { readUntil: 'eof'})
chunk.res = HeaderChunk.parse(chunk.buffer);
If anyone knows how to fix this it would be appreciated! I found something saying to use this on a github node issue but I wouldn't know how to integrate it, https://www.npmjs.com/package/int64-buffer