Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions BufferList.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,42 @@ interface BufferList {

readFloatLE: Buffer['readFloatLE'];

/**
* All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
* See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.
*
* @param offset
*/

readBigInt64BE: Buffer['readBigInt64BE'];

/**
* All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
* See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.
*
* @param offset
*/

readBigInt64LE: Buffer['readBigInt64LE'];

/**
* All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
* See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.
*
* @param offset
*/

readBigUInt64BE: Buffer['readBigUInt64BE'];

/**
* All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
* See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.
*
* @param offset
*/

readBigUInt64LE: Buffer['readBigUInt64LE'];

/**
* All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
* See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.
Expand Down
4 changes: 4 additions & 0 deletions BufferList.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ BufferList.prototype._match = function (offset, search) {
readDoubleLE: 8,
readFloatBE: 4,
readFloatLE: 4,
readBigInt64BE: 8,
readBigInt64LE: 8,
readBigUInt64BE: 8,
readBigUInt64LE: 8,
readInt32BE: 4,
readInt32LE: 4,
readUInt32BE: 4,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bl.pipe(fs.createWriteStream('gibberish.txt'))
* <a href="#duplicate"><code>bl.<b>duplicate()</b></code></a>
* <a href="#consume"><code>bl.<b>consume(bytes)</b></code></a>
* <a href="#toString"><code>bl.<b>toString([encoding, [ start, [ end ]]])</b></code></a>
* <a href="#readXX"><code>bl.<b>readDoubleBE()</b></code>, <code>bl.<b>readDoubleLE()</b></code>, <code>bl.<b>readFloatBE()</b></code>, <code>bl.<b>readFloatLE()</b></code>, <code>bl.<b>readInt32BE()</b></code>, <code>bl.<b>readInt32LE()</b></code>, <code>bl.<b>readUInt32BE()</b></code>, <code>bl.<b>readUInt32LE()</b></code>, <code>bl.<b>readInt16BE()</b></code>, <code>bl.<b>readInt16LE()</b></code>, <code>bl.<b>readUInt16BE()</b></code>, <code>bl.<b>readUInt16LE()</b></code>, <code>bl.<b>readInt8()</b></code>, <code>bl.<b>readUInt8()</b></code></a>
* <a href="#readXX"><code>bl.<b>readDoubleBE()</b></code>, <code>bl.<b>readDoubleLE()</b></code>, <code>bl.<b>readFloatBE()</b></code>, <code>bl.<b>readFloatLE()</b></code>, <code>bl.<b>readBigInt64BE()</b></code>, <code>bl.<b>readBigInt64LE()</b></code>, <code>bl.<b>readBigUInt64BE()</b></code>, <code>bl.<b>readBigUInt64LE()</b></code>, <code>bl.<b>readInt32BE()</b></code>, <code>bl.<b>readInt32LE()</b></code>, <code>bl.<b>readUInt32BE()</b></code>, <code>bl.<b>readUInt32LE()</b></code>, <code>bl.<b>readInt16BE()</b></code>, <code>bl.<b>readInt16LE()</b></code>, <code>bl.<b>readUInt16BE()</b></code>, <code>bl.<b>readUInt16LE()</b></code>, <code>bl.<b>readInt8()</b></code>, <code>bl.<b>readUInt8()</b></code></a>
* <a href="#ctorStream"><code><b>new BufferListStream([ callback ])</b></code></a>

--------------------------------------------------------
Expand Down Expand Up @@ -194,7 +194,7 @@ console.log(bl.toString())

--------------------------------------------------------
<a name="readXX"></a>
### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()
### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readBigIntBE(), bl.readBigIntLE(), bl.readBigUIntBE(), bl.readBigUIntLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()

All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently.

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": "standard *.js test/*.js",
"test": "npm run lint && npm run test:types && node test/test.js | faucet",
"test:ci": "npm run lint && node test/test.js && npm run test:types",
"test:types": "tsc --allowJs --noEmit test/test.js",
"test:types": "tsc --target esnext --moduleResolution node --allowJs --noEmit test/test.js",
"build": "true"
},
"repository": {
Expand All @@ -30,14 +30,14 @@
"dependencies": {
"buffer": "^6.0.3",
"inherits": "^2.0.4",
"readable-stream": "^3.4.0"
"readable-stream": "^4.2.0"
},
"devDependencies": {
"@types/readable-stream": "^2.3.13",
"faucet": "~0.0.1",
"standard": "^17.0.0",
"tape": "^5.2.2",
"typescript": "~4.7.3"
"typescript": "~4.8.4"
},
"release": {
"branches": [
Expand Down
34 changes: 34 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,40 @@ tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t
t.end()
})

tape('test readBigUInt64LE / readBigUInt64BE / readBigInt64LE / readBigInt64BE', function (t) {
const buf1 = Buffer.alloc(1)
const buf2 = Buffer.alloc(3)
const buf3 = Buffer.alloc(2)
const buf4 = Buffer.alloc(5)
const bl = new BufferListStream()

buf1[0] = 0x05
buf2[0] = 0x07

buf2[1] = 0x03
buf2[2] = 0x04
buf3[0] = 0x23
buf3[1] = 0x42
buf4[0] = 0x00
buf4[1] = 0x01
buf4[2] = 0x02
buf4[3] = 0x03

buf4[4] = 0x04

bl.append(buf1)
bl.append(buf2)
bl.append(buf3)
bl.append(buf4)

t.equal(bl.readBigUInt64BE(2), 0x0304234200010203n)
t.equal(bl.readBigUInt64LE(2), 0x0302010042230403n)
t.equal(bl.readBigInt64BE(2), 0x0304234200010203n)
t.equal(bl.readBigInt64LE(2), 0x0302010042230403n)

t.end()
})

tape('test readUIntLE / readUIntBE / readIntLE / readIntBE', function (t) {
const buf1 = Buffer.alloc(1)
const buf2 = Buffer.alloc(3)
Expand Down