bl 5.1.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/BufferList.d.ts CHANGED
@@ -205,6 +205,42 @@ interface BufferList {
205
205
 
206
206
  readFloatLE: Buffer['readFloatLE'];
207
207
 
208
+ /**
209
+ * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
210
+ * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.
211
+ *
212
+ * @param offset
213
+ */
214
+
215
+ readBigInt64BE: Buffer['readBigInt64BE'];
216
+
217
+ /**
218
+ * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
219
+ * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.
220
+ *
221
+ * @param offset
222
+ */
223
+
224
+ readBigInt64LE: Buffer['readBigInt64LE'];
225
+
226
+ /**
227
+ * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
228
+ * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.
229
+ *
230
+ * @param offset
231
+ */
232
+
233
+ readBigUInt64BE: Buffer['readBigUInt64BE'];
234
+
235
+ /**
236
+ * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
237
+ * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.
238
+ *
239
+ * @param offset
240
+ */
241
+
242
+ readBigUInt64LE: Buffer['readBigUInt64LE'];
243
+
208
244
  /**
209
245
  * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
210
246
  * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.
package/BufferList.js CHANGED
@@ -350,6 +350,10 @@ BufferList.prototype._match = function (offset, search) {
350
350
  readDoubleLE: 8,
351
351
  readFloatBE: 4,
352
352
  readFloatLE: 4,
353
+ readBigInt64BE: 8,
354
+ readBigInt64LE: 8,
355
+ readBigUInt64BE: 8,
356
+ readBigUInt64LE: 8,
353
357
  readInt32BE: 4,
354
358
  readInt32LE: 4,
355
359
  readUInt32BE: 4,
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## [6.0.0](https://github.com/rvagg/bl/compare/v5.1.0...v6.0.0) (2022-10-19)
2
+
3
+
4
+ ### ⚠ BREAKING CHANGES
5
+
6
+ * **deps:** bump readable-stream from 3.6.0 to 4.2.0
7
+ * added bigint (Int64) support
8
+
9
+ ### Features
10
+
11
+ * added bigint (Int64) support ([131ad32](https://github.com/rvagg/bl/commit/131ad3217b91090323513a8ea3ef179e8427cf47))
12
+
13
+
14
+ ### Trivial Changes
15
+
16
+ * add TypeScript definitions for BigInt ([78c5ff4](https://github.com/rvagg/bl/commit/78c5ff489235a4e4233086c364133123c71acef4))
17
+ * **deps-dev:** bump typescript from 4.7.4 to 4.8.4 ([dba13e1](https://github.com/rvagg/bl/commit/dba13e1cadc5857dde6a9425e975faf2abbb270f))
18
+ * **deps:** bump readable-stream from 3.6.0 to 4.2.0 ([fa03eda](https://github.com/rvagg/bl/commit/fa03eda54b4412c0fdfc9053bd0b0bebaf80bfd9))
19
+ * **docs:** BigInt in API docs ([c68af50](https://github.com/rvagg/bl/commit/c68af500a04b2c3a14132ae6946412d2e39402d0))
20
+
1
21
  ## [5.1.0](https://github.com/rvagg/bl/compare/v5.0.0...v5.1.0) (2022-10-18)
2
22
 
3
23
 
package/README.md CHANGED
@@ -98,7 +98,7 @@ bl.pipe(fs.createWriteStream('gibberish.txt'))
98
98
  * <a href="#duplicate"><code>bl.<b>duplicate()</b></code></a>
99
99
  * <a href="#consume"><code>bl.<b>consume(bytes)</b></code></a>
100
100
  * <a href="#toString"><code>bl.<b>toString([encoding, [ start, [ end ]]])</b></code></a>
101
- * <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>
101
+ * <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>
102
102
  * <a href="#ctorStream"><code><b>new BufferListStream([ callback ])</b></code></a>
103
103
 
104
104
  --------------------------------------------------------
@@ -194,7 +194,7 @@ console.log(bl.toString())
194
194
 
195
195
  --------------------------------------------------------
196
196
  <a name="readXX"></a>
197
- ### 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()
197
+ ### 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()
198
198
 
199
199
  All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently.
200
200
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bl",
3
- "version": "5.1.0",
3
+ "version": "6.0.0",
4
4
  "description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!",
5
5
  "license": "MIT",
6
6
  "main": "bl.js",
@@ -8,7 +8,7 @@
8
8
  "lint": "standard *.js test/*.js",
9
9
  "test": "npm run lint && npm run test:types && node test/test.js | faucet",
10
10
  "test:ci": "npm run lint && node test/test.js && npm run test:types",
11
- "test:types": "tsc --allowJs --noEmit test/test.js",
11
+ "test:types": "tsc --target esnext --moduleResolution node --allowJs --noEmit test/test.js",
12
12
  "build": "true"
13
13
  },
14
14
  "repository": {
@@ -30,14 +30,14 @@
30
30
  "dependencies": {
31
31
  "buffer": "^6.0.3",
32
32
  "inherits": "^2.0.4",
33
- "readable-stream": "^3.4.0"
33
+ "readable-stream": "^4.2.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/readable-stream": "^2.3.13",
37
37
  "faucet": "~0.0.1",
38
38
  "standard": "^17.0.0",
39
39
  "tape": "^5.2.2",
40
- "typescript": "~4.7.3"
40
+ "typescript": "~4.8.4"
41
41
  },
42
42
  "release": {
43
43
  "branches": [
package/test/test.js CHANGED
@@ -388,6 +388,40 @@ tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t
388
388
  t.end()
389
389
  })
390
390
 
391
+ tape('test readBigUInt64LE / readBigUInt64BE / readBigInt64LE / readBigInt64BE', function (t) {
392
+ const buf1 = Buffer.alloc(1)
393
+ const buf2 = Buffer.alloc(3)
394
+ const buf3 = Buffer.alloc(2)
395
+ const buf4 = Buffer.alloc(5)
396
+ const bl = new BufferListStream()
397
+
398
+ buf1[0] = 0x05
399
+ buf2[0] = 0x07
400
+
401
+ buf2[1] = 0x03
402
+ buf2[2] = 0x04
403
+ buf3[0] = 0x23
404
+ buf3[1] = 0x42
405
+ buf4[0] = 0x00
406
+ buf4[1] = 0x01
407
+ buf4[2] = 0x02
408
+ buf4[3] = 0x03
409
+
410
+ buf4[4] = 0x04
411
+
412
+ bl.append(buf1)
413
+ bl.append(buf2)
414
+ bl.append(buf3)
415
+ bl.append(buf4)
416
+
417
+ t.equal(bl.readBigUInt64BE(2), 0x0304234200010203n)
418
+ t.equal(bl.readBigUInt64LE(2), 0x0302010042230403n)
419
+ t.equal(bl.readBigInt64BE(2), 0x0304234200010203n)
420
+ t.equal(bl.readBigInt64LE(2), 0x0302010042230403n)
421
+
422
+ t.end()
423
+ })
424
+
391
425
  tape('test readUIntLE / readUIntBE / readIntLE / readIntBE', function (t) {
392
426
  const buf1 = Buffer.alloc(1)
393
427
  const buf2 = Buffer.alloc(3)