bare-buffer 3.3.1 → 3.4.1

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/CMakeLists.txt CHANGED
@@ -1,13 +1,13 @@
1
- cmake_minimum_required(VERSION 3.25)
1
+ cmake_minimum_required(VERSION 4.0)
2
2
 
3
3
  find_package(cmake-bare REQUIRED PATHS node_modules/cmake-bare)
4
4
  find_package(cmake-fetch REQUIRED PATHS node_modules/cmake-fetch)
5
5
 
6
6
  project(bare_buffer C)
7
7
 
8
- fetch_package("github:holepunchto/libutf#9509b28")
9
- fetch_package("github:holepunchto/libbase64#86afd29")
10
- fetch_package("github:holepunchto/libhex#1dfad95")
8
+ fetch_package("github:holepunchto/libutf#6b1a36f")
9
+ fetch_package("github:holepunchto/libbase64#47d5334")
10
+ fetch_package("github:holepunchto/libhex#1739a23")
11
11
 
12
12
  add_bare_module(bare_buffer)
13
13
 
package/index.d.ts CHANGED
@@ -22,23 +22,13 @@ interface Buffer extends Uint8Array {
22
22
  sourceEnd?: number
23
23
  ): number
24
24
 
25
- copy(
26
- target: Buffer,
27
- targetStart?: number,
28
- sourceStart?: number,
29
- sourceEnd?: number
30
- ): number
25
+ copy(target: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number
31
26
 
32
27
  equals(target: Buffer): boolean
33
28
 
34
29
  fill(value: string, encoding?: BufferEncoding): this
35
30
  fill(value: string, offset?: number, encoding?: BufferEncoding): this
36
- fill(
37
- value: string,
38
- offset?: number,
39
- end?: number,
40
- encoding?: BufferEncoding
41
- ): this
31
+ fill(value: string, offset?: number, end?: number, encoding?: BufferEncoding): this
42
32
  fill(value: Buffer | number | boolean, offset?: number, end?: number): this
43
33
 
44
34
  includes(value: string, encoding?: BufferEncoding): boolean
@@ -73,6 +63,9 @@ interface Buffer extends Uint8Array {
73
63
  readInt32BE(offset?: number): number
74
64
  readInt32LE(offset?: number): number
75
65
 
66
+ readIntBE(offset: number, byteLength: number): number
67
+ readIntLE(offset: number, byteLength: number): number
68
+
76
69
  readBigInt64BE(offset?: number): bigint
77
70
  readBigInt64LE(offset?: number): bigint
78
71
 
@@ -89,6 +82,11 @@ interface Buffer extends Uint8Array {
89
82
  readUInt32LE(offset?: number): number
90
83
  readUint32LE(offset?: number): number
91
84
 
85
+ readUIntBE(offset: number, byteLength: number): number
86
+ readUintBE(offset: number, byteLength: number): number
87
+ readUIntLE(offset: number, byteLength: number): number
88
+ readUintLE(offset: number, byteLength: number): number
89
+
92
90
  readBigUInt64BE(offset?: number): bigint
93
91
  readBigUint64BE(offset?: number): bigint
94
92
  readBigUInt64LE(offset?: number): bigint
@@ -96,12 +94,7 @@ interface Buffer extends Uint8Array {
96
94
 
97
95
  write(string: string, encoding?: BufferEncoding): number
98
96
  write(string: string, offset?: number, encoding?: BufferEncoding): number
99
- write(
100
- string: string,
101
- offset?: number,
102
- length?: number,
103
- encoding?: BufferEncoding
104
- ): number
97
+ write(string: string, offset?: number, length?: number, encoding?: BufferEncoding): number
105
98
 
106
99
  writeDoubleBE(value: number, offset?: number): number
107
100
  writeDoubleLE(value: number, offset?: number): number
@@ -117,6 +110,9 @@ interface Buffer extends Uint8Array {
117
110
  writeInt32BE(value: number, offset?: number): number
118
111
  writeInt32LE(value: number, offset?: number): number
119
112
 
113
+ writeIntBE(value: number, offset: number, byteLength: number): number
114
+ writeIntLE(value: number, offset: number, byteLength: number): number
115
+
120
116
  writeBigInt64BE(value: bigint, offset?: number): number
121
117
  writeBigInt64LE(value: bigint, offset?: number): number
122
118
 
@@ -133,6 +129,11 @@ interface Buffer extends Uint8Array {
133
129
  writeUInt32LE(value: number, offset?: number): number
134
130
  writeUint32LE(value: number, offset?: number): number
135
131
 
132
+ writeUIntBE(value: number, offset: number, byteLength: number): number
133
+ writeUintBE(value: number, offset: number, byteLength: number): number
134
+ writeUIntLE(value: number, offset: number, byteLength: number): number
135
+ writeUintLE(value: number, offset: number, byteLength: number): number
136
+
136
137
  writeBigUint64BE(value: bigint, offset?: number): number
137
138
  writeBigUInt64BE(value: bigint, offset?: number): number
138
139
  writeBigUint64LE(value: bigint, offset?: number): number
@@ -150,11 +151,7 @@ declare namespace Buffer {
150
151
 
151
152
  export function isEncoding(encoding: string): encoding is BufferEncoding
152
153
 
153
- export function alloc(
154
- size: number,
155
- fill: string,
156
- encoding?: BufferEncoding
157
- ): Buffer
154
+ export function alloc(size: number, fill: string, encoding?: BufferEncoding): Buffer
158
155
  export function alloc(size: number, fill?: Buffer | number | boolean): Buffer
159
156
 
160
157
  export function allocUnsafe(size: number): Buffer
@@ -175,11 +172,7 @@ declare namespace Buffer {
175
172
  export function from(data: Iterable<number>): Buffer
176
173
  export function from(data: ArrayLike<number>): Buffer
177
174
  export function from(string: string, encoding?: BufferEncoding): Buffer
178
- export function from(
179
- arrayBuffer: ArrayBufferLike,
180
- offset?: number,
181
- length?: number
182
- ): Buffer
175
+ export function from(arrayBuffer: ArrayBufferLike, offset?: number, length?: number): Buffer
183
176
 
184
177
  export function atob(data: unknown): string
185
178
  export function btoa(data: unknown): string
package/index.js CHANGED
@@ -35,19 +35,13 @@ module.exports = exports = class Buffer extends Uint8Array {
35
35
  length = arrayBuffer
36
36
 
37
37
  if (length > constants.MAX_LENGTH) {
38
- throw new RangeError(
39
- `Buffer length must be at most ${constants.MAX_LENGTH}`
40
- )
38
+ throw new RangeError(`Buffer length must be at most ${constants.MAX_LENGTH}`)
41
39
  }
42
40
 
43
- arrayBuffer = uninitialized
44
- ? binding.allocUnsafe(length)
45
- : binding.alloc(length)
41
+ arrayBuffer = uninitialized ? binding.allocUnsafe(length) : binding.alloc(length)
46
42
  } else {
47
43
  if (length > constants.MAX_LENGTH) {
48
- throw new RangeError(
49
- `Buffer length must be at most ${constants.MAX_LENGTH}`
50
- )
44
+ throw new RangeError(`Buffer length must be at most ${constants.MAX_LENGTH}`)
51
45
  }
52
46
 
53
47
  if (typeof offset === 'object' && offset !== null) {
@@ -104,7 +98,6 @@ module.exports = exports = class Buffer extends Uint8Array {
104
98
  const source = this
105
99
 
106
100
  if (source === target) return true
107
-
108
101
  if (source.byteLength !== target.byteLength) return false
109
102
 
110
103
  return (
@@ -164,14 +157,13 @@ module.exports = exports = class Buffer extends Uint8Array {
164
157
 
165
158
  fill(value, offset = 0, end = this.byteLength, encoding = 'utf8') {
166
159
  if (typeof value === 'string') {
167
- // fill(string, encoding)
168
160
  if (typeof offset === 'string') {
161
+ // fill(string, encoding)
169
162
  encoding = offset
170
163
  offset = 0
171
164
  end = this.byteLength
172
-
173
- // fill(string, offset, encoding)
174
165
  } else if (typeof end === 'string') {
166
+ // fill(string, offset, encoding)
175
167
  encoding = end
176
168
  end = this.byteLength
177
169
  }
@@ -290,23 +282,17 @@ module.exports = exports = class Buffer extends Uint8Array {
290
282
  return codecFor(encoding).toString(buffer)
291
283
  }
292
284
 
293
- write(
294
- string,
295
- offset = 0,
296
- length = this.byteLength - offset,
297
- encoding = 'utf8'
298
- ) {
285
+ write(string, offset = 0, length = this.byteLength - offset, encoding = 'utf8') {
299
286
  // write(string)
300
287
  if (arguments.length === 1) return utf8.write(this, string)
301
288
 
302
- // write(string, encoding)
303
289
  if (typeof offset === 'string') {
290
+ // write(string, encoding)
304
291
  encoding = offset
305
292
  offset = 0
306
293
  length = this.byteLength
307
-
308
- // write(string, offset, encoding)
309
294
  } else if (typeof length === 'string') {
295
+ // write(string, offset, encoding)
310
296
  encoding = length
311
297
  length = this.byteLength - offset
312
298
  }
@@ -376,6 +362,26 @@ module.exports = exports = class Buffer extends Uint8Array {
376
362
  return viewOf(this).getInt32(offset, true)
377
363
  }
378
364
 
365
+ readIntBE(offset, byteLength) {
366
+ if (byteLength === 6) return readInt48BE(viewOf(this), offset)
367
+ if (byteLength === 5) return readInt40BE(viewOf(this), offset)
368
+ if (byteLength === 3) return readInt24BE(viewOf(this), offset)
369
+ if (byteLength === 4) return this.readInt32BE(offset)
370
+ if (byteLength === 2) return this.readInt16BE(offset)
371
+ if (byteLength === 1) return this.readInt8(offset)
372
+ throw new RangeError(`Byte length must be between 1 and 6`)
373
+ }
374
+
375
+ readIntLE(offset, byteLength) {
376
+ if (byteLength === 6) return readInt48LE(viewOf(this), offset)
377
+ if (byteLength === 5) return readInt40LE(viewOf(this), offset)
378
+ if (byteLength === 3) return readInt24LE(viewOf(this), offset)
379
+ if (byteLength === 4) return this.readInt32LE(offset)
380
+ if (byteLength === 2) return this.readInt16LE(offset)
381
+ if (byteLength === 1) return this.readInt8(offset)
382
+ throw new RangeError(`Byte length must be between 1 and 6`)
383
+ }
384
+
379
385
  readUint8(offset = 0) {
380
386
  return viewOf(this).getUint8(offset)
381
387
  }
@@ -394,6 +400,26 @@ module.exports = exports = class Buffer extends Uint8Array {
394
400
  return viewOf(this).getUint32(offset, true)
395
401
  }
396
402
 
403
+ readUintBE(offset, byteLength) {
404
+ if (byteLength === 6) return readUint48BE(viewOf(this), offset)
405
+ if (byteLength === 5) return readUint40BE(viewOf(this), offset)
406
+ if (byteLength === 3) return readUint24BE(viewOf(this), offset)
407
+ if (byteLength === 4) return this.readUint32BE(offset)
408
+ if (byteLength === 2) return this.readUint16BE(offset)
409
+ if (byteLength === 1) return this.readUint8(offset)
410
+ throw new RangeError(`Byte length must be between 1 and 6`)
411
+ }
412
+
413
+ readUintLE(offset, byteLength) {
414
+ if (byteLength === 6) return readUint48LE(viewOf(this), offset)
415
+ if (byteLength === 5) return readUint40LE(viewOf(this), offset)
416
+ if (byteLength === 3) return readUint24LE(viewOf(this), offset)
417
+ if (byteLength === 4) return this.readUint32LE(offset)
418
+ if (byteLength === 2) return this.readUint16LE(offset)
419
+ if (byteLength === 1) return this.readUint8(offset)
420
+ throw new RangeError(`Byte length must be between 1 and 6`)
421
+ }
422
+
397
423
  readBigUInt64BE(...args) {
398
424
  return this.readBigUint64BE(...args)
399
425
  }
@@ -419,6 +445,13 @@ module.exports = exports = class Buffer extends Uint8Array {
419
445
  return this.readUint32LE(...args)
420
446
  }
421
447
 
448
+ readUIntBE(...args) {
449
+ return this.readUintBE(...args)
450
+ }
451
+ readUIntLE(...args) {
452
+ return this.readUintLE(...args)
453
+ }
454
+
422
455
  writeBigInt64BE(value, offset = 0) {
423
456
  viewOf(this).setBigInt64(offset, value, false)
424
457
  return offset + 8
@@ -478,6 +511,26 @@ module.exports = exports = class Buffer extends Uint8Array {
478
511
  return offset + 4
479
512
  }
480
513
 
514
+ writeIntBE(value, offset, byteLength) {
515
+ if (byteLength === 6) return writeInt48BE(value, viewOf(this), offset)
516
+ if (byteLength === 5) return writeInt40BE(value, viewOf(this), offset)
517
+ if (byteLength === 3) return writeInt24BE(value, viewOf(this), offset)
518
+ if (byteLength === 4) return this.writeInt32BE(value, offset)
519
+ if (byteLength === 2) return this.writeInt16BE(value, offset)
520
+ if (byteLength === 1) return this.writeInt8(value, offset)
521
+ throw new RangeError(`Byte length must be between 1 and 6`)
522
+ }
523
+
524
+ writeIntLE(value, offset, byteLength) {
525
+ if (byteLength === 6) return writeInt48LE(value, viewOf(this), offset)
526
+ if (byteLength === 5) return writeInt40LE(value, viewOf(this), offset)
527
+ if (byteLength === 3) return writeInt24LE(value, viewOf(this), offset)
528
+ if (byteLength === 4) return this.writeInt32LE(value, offset)
529
+ if (byteLength === 2) return this.writeInt16LE(value, offset)
530
+ if (byteLength === 1) return this.writeInt8(value, offset)
531
+ throw new RangeError(`Byte length must be between 1 and 6`)
532
+ }
533
+
481
534
  writeUint8(value, offset = 0) {
482
535
  viewOf(this).setUint8(offset, value, true)
483
536
  return offset + 1
@@ -501,6 +554,26 @@ module.exports = exports = class Buffer extends Uint8Array {
501
554
  return offset + 4
502
555
  }
503
556
 
557
+ writeUintBE(value, offset, byteLength) {
558
+ if (byteLength === 6) return writeUint48BE(value, viewOf(this), offset)
559
+ if (byteLength === 5) return writeUint40BE(value, viewOf(this), offset)
560
+ if (byteLength === 3) return writeUint24BE(value, viewOf(this), offset)
561
+ if (byteLength === 4) return this.writeUint32BE(value, offset)
562
+ if (byteLength === 2) return this.writeUint16BE(value, offset)
563
+ if (byteLength === 1) return this.writeUint8(value, offset)
564
+ throw new RangeError(`Byte length must be between 1 and 6`)
565
+ }
566
+
567
+ writeUintLE(value, offset, byteLength) {
568
+ if (byteLength === 6) return writeUint48LE(value, viewOf(this), offset)
569
+ if (byteLength === 5) return writeUint40LE(value, viewOf(this), offset)
570
+ if (byteLength === 3) return writeUint24LE(value, viewOf(this), offset)
571
+ if (byteLength === 4) return this.writeUint32LE(value, offset)
572
+ if (byteLength === 2) return this.writeUint16LE(value, offset)
573
+ if (byteLength === 1) return this.writeUint8(value, offset)
574
+ throw new RangeError(`Byte length must be between 1 and 6`)
575
+ }
576
+
504
577
  writeBigUInt64BE(...args) {
505
578
  return this.writeBigUint64BE(...args)
506
579
  }
@@ -525,6 +598,13 @@ module.exports = exports = class Buffer extends Uint8Array {
525
598
  writeUInt32LE(...args) {
526
599
  return this.writeUint32LE(...args)
527
600
  }
601
+
602
+ writeUIntBE(...args) {
603
+ return this.writeUintBE(...args)
604
+ }
605
+ writeUIntLE(...args) {
606
+ return this.writeUintLE(...args)
607
+ }
528
608
  }
529
609
 
530
610
  const Buffer = exports
@@ -567,9 +647,7 @@ function viewOf(buffer) {
567
647
  exports.isBuffer = function isBuffer(value) {
568
648
  if (value instanceof Buffer) return true
569
649
 
570
- return (
571
- typeof value === 'object' && value !== null && value[kind] === Buffer[kind]
572
- )
650
+ return typeof value === 'object' && value !== null && value[kind] === Buffer[kind]
573
651
  }
574
652
 
575
653
  exports.isEncoding = function isEncoding(encoding) {
@@ -604,14 +682,7 @@ exports.byteLength = function byteLength(string, encoding) {
604
682
  }
605
683
 
606
684
  exports.compare = function compare(a, b) {
607
- return binding.compare(
608
- a.buffer,
609
- a.byteOffset,
610
- a.byteLength,
611
- b.buffer,
612
- b.byteOffset,
613
- b.byteLength
614
- )
685
+ return binding.compare(a.buffer, a.byteOffset, a.byteLength, b.buffer, b.byteOffset, b.byteLength)
615
686
  }
616
687
 
617
688
  exports.concat = function concat(buffers, length) {
@@ -630,7 +701,6 @@ exports.concat = function concat(buffers, length) {
630
701
  }
631
702
 
632
703
  result.set(buffer, offset)
633
-
634
704
  offset += buffer.byteLength
635
705
  }
636
706
 
@@ -752,3 +822,181 @@ exports.btoa = function btoa(data) {
752
822
 
753
823
  return Buffer.from(data, 'latin1').toString('base64')
754
824
  }
825
+
826
+ function readInt48BE(view, offset) {
827
+ const hi = view.getUint16(offset, false)
828
+ const lo = view.getUint32(offset + 2, false)
829
+ let value = lo + hi * 0x100000000
830
+ if (hi & 0x8000) value -= 0x1000000000000
831
+ return value
832
+ }
833
+
834
+ function readInt48LE(view, offset) {
835
+ const lo = view.getUint32(offset, true)
836
+ const hi = view.getUint16(offset + 4, true)
837
+ let value = lo + hi * 0x100000000
838
+ if (hi & 0x8000) value -= 0x1000000000000
839
+ return value
840
+ }
841
+
842
+ function readInt40BE(view, offset) {
843
+ const hi = view.getUint8(offset)
844
+ const lo = view.getUint32(offset + 1, false)
845
+ let value = lo + hi * 0x100000000
846
+ if (hi & 0x80) value -= 0x10000000000
847
+ return value
848
+ }
849
+
850
+ function readInt40LE(view, offset) {
851
+ const lo = view.getUint32(offset, true)
852
+ const hi = view.getUint8(offset + 4)
853
+ let value = lo + hi * 0x100000000
854
+ if (hi & 0x80) value -= 0x10000000000
855
+ return value
856
+ }
857
+
858
+ function readInt24BE(view, offset) {
859
+ const value =
860
+ (view.getUint8(offset) << 16) | (view.getUint8(offset + 1) << 8) | view.getUint8(offset + 2)
861
+ return value & 0x800000 ? value - 0x1000000 : value
862
+ }
863
+
864
+ function readInt24LE(view, offset) {
865
+ const value =
866
+ view.getUint8(offset) | (view.getUint8(offset + 1) << 8) | (view.getUint8(offset + 2) << 16)
867
+ return value & 0x800000 ? value - 0x1000000 : value
868
+ }
869
+
870
+ function readUint48BE(view, offset) {
871
+ const hi = view.getUint16(offset, false)
872
+ const lo = view.getUint32(offset + 2, false)
873
+ return lo + hi * 0x100000000
874
+ }
875
+
876
+ function readUint48LE(view, offset) {
877
+ const lo = view.getUint32(offset, true)
878
+ const hi = view.getUint16(offset + 4, true)
879
+ return lo + hi * 0x100000000
880
+ }
881
+
882
+ function readUint40BE(view, offset) {
883
+ const hi = view.getUint8(offset)
884
+ const lo = view.getUint32(offset + 1, false)
885
+ return lo + hi * 0x100000000
886
+ }
887
+
888
+ function readUint40LE(view, offset) {
889
+ const lo = view.getUint32(offset, true)
890
+ const hi = view.getUint8(offset + 4)
891
+ return lo + hi * 0x100000000
892
+ }
893
+
894
+ function readUint24BE(view, offset) {
895
+ return (
896
+ (view.getUint8(offset) << 16) | (view.getUint8(offset + 1) << 8) | view.getUint8(offset + 2)
897
+ )
898
+ }
899
+
900
+ function readUint24LE(view, offset) {
901
+ return (
902
+ view.getUint8(offset) | (view.getUint8(offset + 1) << 8) | (view.getUint8(offset + 2) << 16)
903
+ )
904
+ }
905
+
906
+ function writeInt48BE(value, view, offset) {
907
+ if (value < 0) value += 0x1000000000000
908
+ const hi = Math.floor(value / 0x100000000)
909
+ const lo = value >>> 0
910
+ view.setUint16(offset, hi, false)
911
+ view.setUint32(offset + 2, lo, false)
912
+ return offset + 6
913
+ }
914
+
915
+ function writeInt48LE(value, view, offset) {
916
+ if (value < 0) value += 0x1000000000000
917
+ const hi = Math.floor(value / 0x100000000)
918
+ const lo = value >>> 0
919
+ view.setUint32(offset, lo, true)
920
+ view.setUint16(offset + 4, hi, true)
921
+ return offset + 6
922
+ }
923
+
924
+ function writeInt40BE(value, view, offset) {
925
+ if (value < 0) value += 0x10000000000
926
+ const hi = Math.floor(value / 0x100000000)
927
+ const lo = value >>> 0
928
+ view.setUint8(offset, hi)
929
+ view.setUint32(offset + 1, lo, false)
930
+ return offset + 5
931
+ }
932
+
933
+ function writeInt40LE(value, view, offset) {
934
+ if (value < 0) value += 0x10000000000
935
+ const hi = Math.floor(value / 0x100000000)
936
+ const lo = value >>> 0
937
+ view.setUint32(offset, lo, true)
938
+ view.setUint8(offset + 4, hi)
939
+ return offset + 5
940
+ }
941
+
942
+ function writeInt24BE(value, view, offset) {
943
+ if (value < 0) value += 0x1000000
944
+ view.setUint8(offset, (value >> 16) & 0xff)
945
+ view.setUint8(offset + 1, (value >> 8) & 0xff)
946
+ view.setUint8(offset + 2, value & 0xff)
947
+ return offset + 3
948
+ }
949
+
950
+ function writeInt24LE(value, view, offset) {
951
+ if (value < 0) value += 0x1000000
952
+ view.setUint8(offset, value & 0xff)
953
+ view.setUint8(offset + 1, (value >> 8) & 0xff)
954
+ view.setUint8(offset + 2, (value >> 16) & 0xff)
955
+ return offset + 3
956
+ }
957
+
958
+ function writeUint48BE(value, view, offset) {
959
+ const hi = Math.floor(value / 0x100000000)
960
+ const lo = value >>> 0
961
+ view.setUint16(offset, hi, false)
962
+ view.setUint32(offset + 2, lo, false)
963
+ return offset + 6
964
+ }
965
+
966
+ function writeUint48LE(value, view, offset) {
967
+ const hi = Math.floor(value / 0x100000000)
968
+ const lo = value >>> 0
969
+ view.setUint32(offset, lo, true)
970
+ view.setUint16(offset + 4, hi, true)
971
+ return offset + 6
972
+ }
973
+
974
+ function writeUint40BE(value, view, offset) {
975
+ const hi = Math.floor(value / 0x100000000)
976
+ const lo = value >>> 0
977
+ view.setUint8(offset, hi)
978
+ view.setUint32(offset + 1, lo, false)
979
+ return offset + 5
980
+ }
981
+
982
+ function writeUint40LE(value, view, offset) {
983
+ const hi = Math.floor(value / 0x100000000)
984
+ const lo = value >>> 0
985
+ view.setUint32(offset, lo, true)
986
+ view.setUint8(offset + 4, hi)
987
+ return offset + 5
988
+ }
989
+
990
+ function writeUint24BE(value, view, offset) {
991
+ view.setUint8(offset, (value >> 16) & 0xff)
992
+ view.setUint8(offset + 1, (value >> 8) & 0xff)
993
+ view.setUint8(offset + 2, value & 0xff)
994
+ return offset + 3
995
+ }
996
+
997
+ function writeUint24LE(value, view, offset) {
998
+ view.setUint8(offset, value & 0xff)
999
+ view.setUint8(offset + 1, (value >> 8) & 0xff)
1000
+ view.setUint8(offset + 2, (value >> 16) & 0xff)
1001
+ return offset + 3
1002
+ }
package/lib/base64.js CHANGED
@@ -10,18 +10,9 @@ exports.byteLength = function byteLength(string) {
10
10
  }
11
11
 
12
12
  exports.toString = function toString(buffer) {
13
- return binding.toStringBase64(
14
- buffer.buffer,
15
- buffer.byteOffset,
16
- buffer.byteLength
17
- )
13
+ return binding.toStringBase64(buffer.buffer, buffer.byteOffset, buffer.byteLength)
18
14
  }
19
15
 
20
16
  exports.write = function write(buffer, string) {
21
- return binding.writeBase64(
22
- buffer.buffer,
23
- buffer.byteOffset,
24
- buffer.byteLength,
25
- string
26
- )
17
+ return binding.writeBase64(buffer.buffer, buffer.byteOffset, buffer.byteLength, string)
27
18
  }
package/lib/base64url.js CHANGED
@@ -10,18 +10,9 @@ exports.byteLength = function byteLength(string) {
10
10
  }
11
11
 
12
12
  exports.toString = function toString(buffer) {
13
- return binding.toStringBase64URL(
14
- buffer.buffer,
15
- buffer.byteOffset,
16
- buffer.byteLength
17
- )
13
+ return binding.toStringBase64URL(buffer.buffer, buffer.byteOffset, buffer.byteLength)
18
14
  }
19
15
 
20
16
  exports.write = function write(buffer, string) {
21
- return binding.writeBase64(
22
- buffer.buffer,
23
- buffer.byteOffset,
24
- buffer.byteLength,
25
- string
26
- )
17
+ return binding.writeBase64(buffer.buffer, buffer.byteOffset, buffer.byteLength, string)
27
18
  }
package/lib/hex.js CHANGED
@@ -5,18 +5,9 @@ exports.byteLength = function byteLength(string) {
5
5
  }
6
6
 
7
7
  exports.toString = function toString(buffer) {
8
- return binding.toStringHex(
9
- buffer.buffer,
10
- buffer.byteOffset,
11
- buffer.byteLength
12
- )
8
+ return binding.toStringHex(buffer.buffer, buffer.byteOffset, buffer.byteLength)
13
9
  }
14
10
 
15
11
  exports.write = function write(buffer, string) {
16
- return binding.writeHex(
17
- buffer.buffer,
18
- buffer.byteOffset,
19
- buffer.byteLength,
20
- string
21
- )
12
+ return binding.writeHex(buffer.buffer, buffer.byteOffset, buffer.byteLength, string)
22
13
  }
package/lib/latin1.js CHANGED
@@ -5,18 +5,9 @@ exports.byteLength = function byteLength(string) {
5
5
  }
6
6
 
7
7
  exports.toString = function toString(buffer) {
8
- return binding.toStringLatin1(
9
- buffer.buffer,
10
- buffer.byteOffset,
11
- buffer.byteLength
12
- )
8
+ return binding.toStringLatin1(buffer.buffer, buffer.byteOffset, buffer.byteLength)
13
9
  }
14
10
 
15
11
  exports.write = function write(buffer, string) {
16
- return binding.writeLatin1(
17
- buffer.buffer,
18
- buffer.byteOffset,
19
- buffer.byteLength,
20
- string
21
- )
12
+ return binding.writeLatin1(buffer.buffer, buffer.byteOffset, buffer.byteLength, string)
22
13
  }
package/lib/utf16le.js CHANGED
@@ -5,18 +5,9 @@ exports.byteLength = function byteLength(string) {
5
5
  }
6
6
 
7
7
  exports.toString = function toString(buffer) {
8
- return binding.toStringUTF16LE(
9
- buffer.buffer,
10
- buffer.byteOffset,
11
- buffer.byteLength
12
- )
8
+ return binding.toStringUTF16LE(buffer.buffer, buffer.byteOffset, buffer.byteLength)
13
9
  }
14
10
 
15
11
  exports.write = function write(buffer, string) {
16
- return binding.writeUTF16LE(
17
- buffer.buffer,
18
- buffer.byteOffset,
19
- buffer.byteLength,
20
- string
21
- )
12
+ return binding.writeUTF16LE(buffer.buffer, buffer.byteOffset, buffer.byteLength, string)
22
13
  }
package/lib/utf8.js CHANGED
@@ -5,18 +5,9 @@ exports.byteLength = function byteLength(string) {
5
5
  }
6
6
 
7
7
  exports.toString = function toString(buffer) {
8
- return binding.toStringUTF8(
9
- buffer.buffer,
10
- buffer.byteOffset,
11
- buffer.byteLength
12
- )
8
+ return binding.toStringUTF8(buffer.buffer, buffer.byteOffset, buffer.byteLength)
13
9
  }
14
10
 
15
11
  exports.write = function write(buffer, string) {
16
- return binding.writeUTF8(
17
- buffer.buffer,
18
- buffer.byteOffset,
19
- buffer.byteLength,
20
- string
21
- )
12
+ return binding.writeUTF8(buffer.buffer, buffer.byteOffset, buffer.byteLength, string)
22
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-buffer",
3
- "version": "3.3.1",
3
+ "version": "3.4.1",
4
4
  "description": "Native buffers for JavaScript",
5
5
  "exports": {
6
6
  "./package": "./package.json",
@@ -50,6 +50,6 @@
50
50
  "cmake-bare": "^1.1.6",
51
51
  "cmake-fetch": "^1.0.0",
52
52
  "prettier": "^3.3.3",
53
- "prettier-config-standard": "^7.0.0"
53
+ "prettier-config-holepunch": "^2.0.0"
54
54
  }
55
55
  }