diff --git a/src/parser/utils.ts b/src/parser/utils.ts index 905e8aa6..f8490142 100644 --- a/src/parser/utils.ts +++ b/src/parser/utils.ts @@ -58,7 +58,8 @@ export function haveBuffer(): boolean { /** Callable in any environment to check if value is a Buffer */ export function isBuffer(value: unknown): value is Buffer { - return typeof value === 'object' && value?.constructor?.name === 'Buffer'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return isUint8Array(value) && typeof (value as any)?.toJSON === 'function'; } // To ensure that 0.4 of node works correctly