Skip to content

Commit 4192620

Browse files
committed
ffix: remove Int8Array support in writeData to fix type error.
1 parent dc4fadc commit 4192620

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/dynamicBuffer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,7 +2344,7 @@ export class DynamicBuffer {
23442344

23452345
/**
23462346
* Write data into internal buffer with the specified offset, and the type of data should be one
2347-
* of string, Buffer, or Uint8Array.
2347+
* of string or Buffer.
23482348
*
23492349
* @param data Data to write to buffer.
23502350
* @param offset Number of bytes to skip before starting to write data.
@@ -2354,13 +2354,13 @@ export class DynamicBuffer {
23542354
* @returns Number of bytes written.
23552355
*/
23562356
private writeData(
2357-
data: string | Buffer | Int8Array,
2357+
data: string | Buffer,
23582358
offset: number,
23592359
length?: number,
23602360
encoding?: BufferEncoding,
23612361
) {
2362-
if (typeof data !== 'string' && !(data instanceof Buffer) && !(data instanceof Uint8Array)) {
2363-
throw new TypeError('argument must be a string, Buffer, or a Int8Array');
2362+
if (typeof data !== 'string' && !(data instanceof Buffer)) {
2363+
throw new TypeError('argument must be a string, or a Buffer');
23642364
}
23652365

23662366
let lengthToWrite = data.length || 0;

0 commit comments

Comments
 (0)