extended-buffer 7.3.0 → 7.3.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/README.md +6 -0
- package/dist/ExtendedBuffer.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -357,6 +357,7 @@ The library defines these error classes:
|
|
|
357
357
|
- `ExtendedBufferError`
|
|
358
358
|
- `ExtendedBufferTypeError`
|
|
359
359
|
- `ExtendedBufferRangeError`
|
|
360
|
+
- `ExtendedBufferUnsupportedError`
|
|
360
361
|
|
|
361
362
|
Common error codes you may see:
|
|
362
363
|
|
|
@@ -365,6 +366,7 @@ Common error codes you may see:
|
|
|
365
366
|
- `INVALID_INTEGER_SIZE_VALUE_TYPE`: size is not a safe integer
|
|
366
367
|
- `INVALID_INTEGER_SIZE_VALUE_RANGE`: integer size not in `1…6`
|
|
367
368
|
- `INVALID_INSTANCE_STATE`: internal invariant check failed
|
|
369
|
+
- `INVALID_BUFFER_TYPE`: attempt write invalid buffer type
|
|
368
370
|
- `VALUE_MUST_BE_AN_INTEGER`: value not a safe integer
|
|
369
371
|
- `VALUE_MUST_BE_AN_UNSIGNED_INTEGER`: value is not a safe integer or less than 0
|
|
370
372
|
- `VALUE_MUST_BE_AN_BIG_INTEGER`: value is not a `bigint`
|
|
@@ -419,3 +421,7 @@ Numbers:
|
|
|
419
421
|
`readInt16BE/LE`, `readUInt16BE/LE`, `readInt32BE/LE`, `readUInt32BE/LE`,
|
|
420
422
|
`readBigInt64BE/LE`, `readBigUInt64BE/LE`,
|
|
421
423
|
`readFloatBE/LE`, `readDoubleBE/LE`
|
|
424
|
+
|
|
425
|
+
## License
|
|
426
|
+
|
|
427
|
+
MIT
|
package/dist/ExtendedBuffer.js
CHANGED
|
@@ -229,7 +229,10 @@ class ExtendedBuffer {
|
|
|
229
229
|
if (value instanceof ExtendedBuffer) {
|
|
230
230
|
return this.writeNativeBuffer(value.nativeBufferView, unshift);
|
|
231
231
|
}
|
|
232
|
-
|
|
232
|
+
if (buffer_1.Buffer.isBuffer(value)) {
|
|
233
|
+
return this.writeNativeBuffer(value, unshift);
|
|
234
|
+
}
|
|
235
|
+
throw new errors_1.ExtendedBufferTypeError('INVALID_BUFFER_TYPE');
|
|
233
236
|
}
|
|
234
237
|
writeString(string, encoding, unshift) {
|
|
235
238
|
const bytes = buffer_1.Buffer.from(string, encoding);
|