extended-buffer 7.3.1 → 7.5.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/README.md CHANGED
@@ -14,6 +14,90 @@ npm install extended-buffer
14
14
 
15
15
  ---
16
16
 
17
+ ## Browser usage (bundlers)
18
+
19
+ `ExtendedBuffer` works in browsers **as long as a Buffer polyfill is available**. Most bundlers can use the `buffer`
20
+ package as a drop-in implementation.
21
+
22
+ Install the polyfill:
23
+
24
+ ```bash
25
+ npm install buffer
26
+ ```
27
+
28
+ If your bundler does not expose `Buffer` globally, add a small shim in your app entry:
29
+
30
+ ```ts
31
+ import { Buffer } from "buffer";
32
+
33
+ if (!globalThis.Buffer) {
34
+ globalThis.Buffer = Buffer;
35
+ }
36
+ ```
37
+
38
+ ### Webpack 5
39
+
40
+ ```js
41
+ // webpack.config.js
42
+ const webpack = require("webpack");
43
+
44
+ module.exports = {
45
+ resolve: {
46
+ fallback: {
47
+ buffer: require.resolve("buffer/")
48
+ }
49
+ },
50
+ plugins: [
51
+ new webpack.ProvidePlugin({
52
+ Buffer: ["buffer", "Buffer"]
53
+ })
54
+ ]
55
+ };
56
+ ```
57
+
58
+ ### Vite
59
+
60
+ ```ts
61
+ // vite.config.ts
62
+ import { defineConfig } from "vite";
63
+
64
+ export default defineConfig({
65
+ resolve: {
66
+ alias: {
67
+ buffer: "buffer"
68
+ }
69
+ },
70
+ optimizeDeps: {
71
+ include: ["buffer"]
72
+ }
73
+ });
74
+ ```
75
+
76
+ ### Rollup
77
+
78
+ ```js
79
+ // rollup.config.js
80
+ import resolve from "@rollup/plugin-node-resolve";
81
+ import commonjs from "@rollup/plugin-commonjs";
82
+ import inject from "@rollup/plugin-inject";
83
+
84
+ export default {
85
+ plugins: [
86
+ resolve({ browser: true, preferBuiltins: false }),
87
+ commonjs(),
88
+ inject({
89
+ Buffer: ["buffer", "Buffer"]
90
+ })
91
+ ]
92
+ };
93
+ ```
94
+
95
+ Notes:
96
+ - BigInt read/write methods require a polyfill that supports Node’s BigInt Buffer APIs.
97
+ - If your tooling already provides a Buffer global, you can skip the shim/inject steps.
98
+
99
+ ---
100
+
17
101
  ## Quick start
18
102
 
19
103
  ```ts
@@ -44,12 +128,37 @@ The buffer stores a contiguous region of bytes. A separate **read pointer** trac
44
128
  ### Views
45
129
 
46
130
  - `nativeBufferView` — a `Buffer` view of **all stored bytes** (from the start of stored data to the end).
47
- - If you need only unread bytes, you can derive it:
131
+ - `bufferView` a **new `ExtendedBuffer` instance** that maps to the same bytes as `nativeBufferView` (**zero-copy**).
132
+ The new instance starts with `pointer = 0`, so you can read/parse without consuming the parent buffer.
133
+
134
+ If you need only unread bytes, you can derive it:
48
135
 
49
136
  ```ts
50
137
  const unread = b.nativeBufferView.subarray(b.pointer);
51
138
  ```
52
139
 
140
+ Example: parse without touching the parent pointer:
141
+
142
+ ```ts
143
+ import { ExtendedBuffer } from 'extended-buffer';
144
+
145
+ const b = new ExtendedBuffer();
146
+ b.writeString("OK");
147
+ b.writeUInt16BE(1337);
148
+
149
+ const v = b.bufferView;
150
+ console.log(v.readString(2)); // "OK"
151
+ console.log(v.readUInt16BE()); // 1337
152
+
153
+ console.log(b.pointer); // 0 (parent is untouched)
154
+ ```
155
+
156
+ Notes:
157
+
158
+ - `bufferView` shares memory with the parent. In-place mutations (e.g. `v.nativeBufferView[0] = 0xff`) will be visible in both.
159
+ - The view usually has no spare head/tail capacity, so calling `v.write*()` will likely trigger a reallocation (copy) and then the two instances will diverge.
160
+
161
+
53
162
  ---
54
163
 
55
164
  ## Construction and options
@@ -60,6 +169,7 @@ type ExtendedBufferOptions = {
60
169
  capacityStep?: number; // how much to grow when resizing
61
170
  nativeAllocSlow?: boolean; // using Buffer.allocUnsafeSlow() when initializing ExtendedBuffer
62
171
  nativeReallocSlow?: boolean; // using Buffer.allocUnsafeSlow() for further reallocations
172
+ initNativeBuffer?: Buffer; // use an existing Buffer as the initial native buffer (no copy)
63
173
  };
64
174
  ```
65
175
 
@@ -81,6 +191,34 @@ const b = new ExtendedBuffer({
81
191
  });
82
192
  ```
83
193
 
194
+ ### Wrap an existing `Buffer` (`initNativeBuffer`)
195
+
196
+ If you already have a Node.js `Buffer` (from a socket, file, etc.) and want to parse it with `ExtendedBuffer`
197
+ **without copying**, pass it as `initNativeBuffer`.
198
+
199
+ - The buffer is **not copied** — it becomes the internal `_nativeBuffer`.
200
+ - The instance starts with `pointer = 0` and `length = initNativeBuffer.length`.
201
+
202
+ ```ts
203
+ import { ExtendedBuffer } from 'extended-buffer';
204
+
205
+ const packet = Buffer.from([0x00, 0x02, 0x4f, 0x4b]); // 2, "OK"
206
+
207
+ const b = new ExtendedBuffer({ initNativeBuffer: packet });
208
+
209
+ const len = b.readUInt16BE();
210
+ console.log(b.readString(len)); // "OK"
211
+ ```
212
+
213
+ You can also reuse an instance:
214
+
215
+ ```ts
216
+ b.initExtendedBuffer(packet);
217
+ ```
218
+
219
+ Note: when you construct from `initNativeBuffer`, the buffer is treated as already filled.
220
+ If you later call `write*()`, it will typically require a reallocation (copy) to make room.
221
+
84
222
  ---
85
223
 
86
224
  ## Writing data
@@ -400,10 +538,10 @@ In non-Node runtimes, `global` may not exist.
400
538
  ## Reference: full public API (names)
401
539
 
402
540
  Properties:
403
- - `length`, `capacity`, `pointer`, `nativeBufferView`
541
+ - `length`, `capacity`, `pointer`, `nativeBufferView`, `bufferView`
404
542
 
405
543
  Core:
406
- - `initExtendedBuffer()`, `assertInstanceState()`, `clean()`
544
+ - `initExtendedBuffer(initNativeBuffer?)`, `assertInstanceState()`, `clean()`
407
545
  - `nativePointer()`, `getWritableSizeStart()`, `getWritableSizeEnd()`, `getWritableSize()`, `getReadableSize()`
408
546
  - `transaction(callback)`
409
547
  - `allocStart(size)`, `allocEnd(size)`
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ExtendedBufferOptions } from './ExtendedBufferOptions';
3
2
  import type { ExtendedBufferTransaction } from './ExtendedBufferTransaction';
4
3
  export declare class ExtendedBuffer<EBO extends ExtendedBufferOptions = ExtendedBufferOptions> {
@@ -18,7 +17,8 @@ export declare class ExtendedBuffer<EBO extends ExtendedBufferOptions = Extended
18
17
  get capacity(): number;
19
18
  get pointer(): number;
20
19
  get nativeBufferView(): Buffer;
21
- initExtendedBuffer(): this;
20
+ get bufferView(): this;
21
+ initExtendedBuffer(initNativeBuffer?: Buffer): this;
22
22
  assertInstanceState(): this;
23
23
  clean(): this;
24
24
  nativePointer(): number;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.ExtendedBuffer = void 0;
27
37
  const buffer_1 = require("buffer");
@@ -29,6 +39,7 @@ const utils = __importStar(require("./utils"));
29
39
  const errors_1 = require("./errors");
30
40
  const DEFAULT_CAPACITY = 16 * 1024;
31
41
  const DEFAULT_CAPACITY_STEP = DEFAULT_CAPACITY;
42
+ const globalScope = utils.getGlobalContext();
32
43
  class ExtendedBuffer {
33
44
  constructor(options) {
34
45
  var _a, _b;
@@ -38,7 +49,7 @@ class ExtendedBuffer {
38
49
  this._capacityStep = (_b = options === null || options === void 0 ? void 0 : options.capacityStep) !== null && _b !== void 0 ? _b : DEFAULT_CAPACITY_STEP;
39
50
  utils.assertUnsignedInteger(this._capacity);
40
51
  utils.assertUnsignedInteger(this._capacityStep);
41
- this.initExtendedBuffer();
52
+ this.initExtendedBuffer(options === null || options === void 0 ? void 0 : options.initNativeBuffer);
42
53
  }
43
54
  createInstanceOptions(options) {
44
55
  return Object.assign({
@@ -64,15 +75,27 @@ class ExtendedBuffer {
64
75
  get nativeBufferView() {
65
76
  return utils.nativeBufferSubarray(this._nativeBuffer, this._pointerStart, this._pointerEnd);
66
77
  }
67
- initExtendedBuffer() {
78
+ get bufferView() {
79
+ return this.createInstance({
80
+ initNativeBuffer: this.nativeBufferView
81
+ });
82
+ }
83
+ initExtendedBuffer(initNativeBuffer) {
68
84
  this._pointer = 0;
69
- this._nativeBuffer = utils.allocNativeBuffer(this._capacity, this._nativeAllocSlow);
70
- this._pointerStart = this._pointerEnd = Math.floor(this._capacity / 2);
85
+ if (initNativeBuffer) {
86
+ this._nativeBuffer = initNativeBuffer;
87
+ this._pointerStart = 0;
88
+ this._pointerEnd = this._nativeBuffer.length;
89
+ }
90
+ else {
91
+ this._nativeBuffer = utils.allocNativeBuffer(this._capacity, this._nativeAllocSlow);
92
+ this._pointerStart = this._pointerEnd = Math.floor(this._capacity / 2);
93
+ }
71
94
  this.assertInstanceState();
72
95
  return this;
73
96
  }
74
97
  assertInstanceState() {
75
- if (!this._nativeBuffer ||
98
+ if (!buffer_1.Buffer.isBuffer(this._nativeBuffer) ||
76
99
  !Number.isSafeInteger(this._pointer) ||
77
100
  !Number.isSafeInteger(this._pointerStart) ||
78
101
  !Number.isSafeInteger(this._pointerEnd) ||
@@ -109,7 +132,6 @@ class ExtendedBuffer {
109
132
  if (this._transaction) {
110
133
  return callback();
111
134
  }
112
- this.assertInstanceState();
113
135
  this._transaction = {
114
136
  pointer: this._pointer,
115
137
  pointerEnd: this._pointerEnd,
@@ -201,8 +223,8 @@ class ExtendedBuffer {
201
223
  return this;
202
224
  }
203
225
  nodeGc() {
204
- if (typeof global.gc === 'function') {
205
- global.gc();
226
+ if (typeof (globalScope === null || globalScope === void 0 ? void 0 : globalScope.gc) === 'function') {
227
+ globalScope.gc();
206
228
  }
207
229
  return this;
208
230
  }
@@ -3,4 +3,5 @@ export type ExtendedBufferOptions = {
3
3
  capacityStep?: number;
4
4
  nativeAllocSlow?: boolean;
5
5
  nativeReallocSlow?: boolean;
6
+ initNativeBuffer?: Buffer;
6
7
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export type ExtendedBufferTransaction = {
3
2
  pointer: number;
4
3
  pointerEnd: number;
@@ -1,2 +1 @@
1
- /// <reference types="node" />
2
1
  export declare function allocNativeBuffer(size: number, allocSlow?: boolean): Buffer;
@@ -1,34 +1,17 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
2
+ var _a;
25
3
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.allocNativeBuffer = void 0;
27
- const os = __importStar(require("os"));
4
+ exports.allocNativeBuffer = allocNativeBuffer;
28
5
  const buffer_1 = require("buffer");
29
6
  const errors_1 = require("../errors");
30
7
  const assert_unsigned_integer_1 = require("./assert-unsigned-integer");
31
- const maxBufferSize = Math.min(buffer_1.kMaxLength, os.totalmem());
8
+ const maxBufferSize = typeof buffer_1.kMaxLength === 'number'
9
+ ? buffer_1.kMaxLength
10
+ : typeof buffer_1.Buffer.kMaxLength === 'number'
11
+ ? buffer_1.Buffer.kMaxLength
12
+ : typeof ((_a = buffer_1.Buffer.constants) === null || _a === void 0 ? void 0 : _a.MAX_LENGTH) === 'number'
13
+ ? buffer_1.Buffer.constants.MAX_LENGTH
14
+ : Number.MAX_SAFE_INTEGER;
32
15
  (0, assert_unsigned_integer_1.assertUnsignedInteger)(maxBufferSize);
33
16
  function allocNativeBuffer(size, allocSlow) {
34
17
  (0, assert_unsigned_integer_1.assertUnsignedInteger)(size);
@@ -37,4 +20,3 @@ function allocNativeBuffer(size, allocSlow) {
37
20
  }
38
21
  return allocSlow ? buffer_1.Buffer.allocUnsafeSlow(size) : buffer_1.Buffer.allocUnsafe(size);
39
22
  }
40
- exports.allocNativeBuffer = allocNativeBuffer;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertBigInteger = void 0;
3
+ exports.assertBigInteger = assertBigInteger;
4
4
  const errors_1 = require("../errors");
5
5
  function assertBigInteger(value) {
6
6
  if (typeof value !== 'bigint') {
7
7
  throw new errors_1.ExtendedBufferTypeError('VALUE_MUST_BE_AN_BIG_INTEGER');
8
8
  }
9
9
  }
10
- exports.assertBigInteger = assertBigInteger;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertIntegerSize = void 0;
3
+ exports.assertIntegerSize = assertIntegerSize;
4
4
  const errors_1 = require("../errors");
5
5
  function assertIntegerSize(value) {
6
6
  if (!Number.isSafeInteger(value)) {
@@ -10,4 +10,3 @@ function assertIntegerSize(value) {
10
10
  throw new errors_1.ExtendedBufferRangeError('INVALID_INTEGER_SIZE_VALUE_RANGE');
11
11
  }
12
12
  }
13
- exports.assertIntegerSize = assertIntegerSize;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertInteger = void 0;
3
+ exports.assertInteger = assertInteger;
4
4
  const errors_1 = require("../errors");
5
5
  function assertInteger(value) {
6
6
  if (!Number.isSafeInteger(value)) {
7
7
  throw new errors_1.ExtendedBufferTypeError('VALUE_MUST_BE_AN_INTEGER');
8
8
  }
9
9
  }
10
- exports.assertInteger = assertInteger;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertSupportBigInteger = void 0;
3
+ exports.assertSupportBigInteger = assertSupportBigInteger;
4
4
  const buffer_1 = require("buffer");
5
5
  const errors_1 = require("../errors");
6
6
  function assertSupportBigInteger() {
@@ -13,4 +13,3 @@ function assertSupportBigInteger() {
13
13
  throw new errors_1.ExtendedBufferUnsupportedError('EXECUTION_ENVIRONMENT_NOT_SUPPORT_BIG_INT');
14
14
  }
15
15
  }
16
- exports.assertSupportBigInteger = assertSupportBigInteger;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertUnsignedBigInteger = void 0;
3
+ exports.assertUnsignedBigInteger = assertUnsignedBigInteger;
4
4
  const errors_1 = require("../errors");
5
5
  function assertUnsignedBigInteger(value) {
6
6
  if (typeof value !== 'bigint' || value < 0) {
7
7
  throw new errors_1.ExtendedBufferTypeError('VALUE_MUST_BE_AN_UNSIGNED_BIG_INTEGER');
8
8
  }
9
9
  }
10
- exports.assertUnsignedBigInteger = assertUnsignedBigInteger;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertUnsignedInteger = void 0;
3
+ exports.assertUnsignedInteger = assertUnsignedInteger;
4
4
  const errors_1 = require("../errors");
5
5
  function assertUnsignedInteger(value) {
6
6
  if (!Number.isSafeInteger(value) || value < 0) {
7
7
  throw new errors_1.ExtendedBufferTypeError('VALUE_MUST_BE_AN_UNSIGNED_INTEGER');
8
8
  }
9
9
  }
10
- exports.assertUnsignedInteger = assertUnsignedInteger;
@@ -0,0 +1 @@
1
+ export declare function getGlobalContext(): NodeJS.Global | undefined;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGlobalContext = getGlobalContext;
4
+ function getGlobalContext() {
5
+ if (typeof globalThis !== 'undefined') {
6
+ return globalThis;
7
+ }
8
+ if (typeof self !== 'undefined') {
9
+ return self;
10
+ }
11
+ if (typeof window !== 'undefined') {
12
+ return window;
13
+ }
14
+ if (typeof global !== 'undefined') {
15
+ return global;
16
+ }
17
+ try {
18
+ return Function('return this')();
19
+ }
20
+ catch (_a) {
21
+ return undefined;
22
+ }
23
+ }
@@ -1,5 +1,6 @@
1
1
  export { assertInteger } from './assert-integer';
2
2
  export { assertBigInteger } from './assert-big-integer';
3
+ export { getGlobalContext } from './get-global-context';
3
4
  export { assertIntegerSize } from './assert-integer-size';
4
5
  export { allocNativeBuffer } from './alloc-native-buffer';
5
6
  export { reallocNativeBuffer } from './realloc-native-buffer';
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertUnsignedBigInteger = exports.assertSupportBigInteger = exports.assertUnsignedInteger = exports.nativeBufferSubarray = exports.reallocNativeBuffer = exports.allocNativeBuffer = exports.assertIntegerSize = exports.assertBigInteger = exports.assertInteger = void 0;
3
+ exports.assertUnsignedBigInteger = exports.assertSupportBigInteger = exports.assertUnsignedInteger = exports.nativeBufferSubarray = exports.reallocNativeBuffer = exports.allocNativeBuffer = exports.assertIntegerSize = exports.getGlobalContext = exports.assertBigInteger = exports.assertInteger = void 0;
4
4
  var assert_integer_1 = require("./assert-integer");
5
5
  Object.defineProperty(exports, "assertInteger", { enumerable: true, get: function () { return assert_integer_1.assertInteger; } });
6
6
  var assert_big_integer_1 = require("./assert-big-integer");
7
7
  Object.defineProperty(exports, "assertBigInteger", { enumerable: true, get: function () { return assert_big_integer_1.assertBigInteger; } });
8
+ var get_global_context_1 = require("./get-global-context");
9
+ Object.defineProperty(exports, "getGlobalContext", { enumerable: true, get: function () { return get_global_context_1.getGlobalContext; } });
8
10
  var assert_integer_size_1 = require("./assert-integer-size");
9
11
  Object.defineProperty(exports, "assertIntegerSize", { enumerable: true, get: function () { return assert_integer_size_1.assertIntegerSize; } });
10
12
  var alloc_native_buffer_1 = require("./alloc-native-buffer");
@@ -1,2 +1 @@
1
- /// <reference types="node" />
2
1
  export declare function nativeBufferSubarray(buffer: Buffer, begin?: number, end?: number): Buffer;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nativeBufferSubarray = void 0;
3
+ exports.nativeBufferSubarray = nativeBufferSubarray;
4
4
  const buffer_1 = require("buffer");
5
5
  const sliceFallback = !(buffer_1.Buffer.allocUnsafe(1).subarray(0) instanceof buffer_1.Buffer);
6
6
  function nativeBufferSubarray(buffer, begin, end) {
7
7
  return sliceFallback ? buffer.slice(begin, end) : buffer.subarray(begin, end);
8
8
  }
9
- exports.nativeBufferSubarray = nativeBufferSubarray;
@@ -1,2 +1 @@
1
- /// <reference types="node" />
2
1
  export declare function reallocNativeBuffer(buffer: Buffer, newSize: number, allocSlow?: boolean): Buffer;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reallocNativeBuffer = void 0;
3
+ exports.reallocNativeBuffer = reallocNativeBuffer;
4
4
  const alloc_native_buffer_1 = require("./alloc-native-buffer");
5
5
  const assert_unsigned_integer_1 = require("./assert-unsigned-integer");
6
6
  function reallocNativeBuffer(buffer, newSize, allocSlow) {
@@ -12,4 +12,3 @@ function reallocNativeBuffer(buffer, newSize, allocSlow) {
12
12
  buffer.copy(newBuffer, 0, 0, Math.min(buffer.length, newBuffer.length));
13
13
  return newBuffer;
14
14
  }
15
- exports.reallocNativeBuffer = reallocNativeBuffer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extended-buffer",
3
- "version": "7.3.1",
3
+ "version": "7.5.0",
4
4
  "description": "Node JS extended Buffer",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "scripts": {
17
17
  "build": "npm run clean && node ./node_modules/.bin/tsc",
18
18
  "test": "node ./node_modules/.bin/mocha",
19
- "coverage": "node ./node_modules/.bin/nyc --reporter=html --reporter=text ./node_modules/.bin/mocha",
19
+ "coverage": "node ./node_modules/.bin/nyc --reporter=lcov --reporter=html --reporter=text ./node_modules/.bin/mocha",
20
20
  "clean": "node -e \"['./dist', './coverage', './.nyc_output'].forEach(item => require('fs').rmSync(item, {recursive:true,force:true}));\"",
21
21
  "prepack": "npm run build"
22
22
  },
@@ -59,6 +59,6 @@
59
59
  "chai": "^4.5.0",
60
60
  "mocha": "^6.2.3",
61
61
  "nyc": "^11.9.0",
62
- "typescript": "^4.7.2"
62
+ "typescript": "^5.9.3"
63
63
  }
64
64
  }