Skip to content

Conversation

@jheer
Copy link
Member

@jheer jheer commented Sep 12, 2025

  • Fix ArrayBufferLike check to be safe in case SharedArrayBuffer is not defined.

@jheer jheer merged commit d95bee3 into main Sep 12, 2025
2 checks passed
const source = data instanceof ArrayBuffer || data instanceof SharedArrayBuffer
? new Uint8Array(data)
: data;
const source = isArrayBufferLike(data) ? new Uint8Array(data) : data;
Copy link
Member

@domoritz domoritz Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you could invert the check, which may be a bit simpler.

export function decodeIPC(data) {
  const source = Array.isArray(data) || ArrayBuffer.isView(data)
    ? data
    : new Uint8Array(data);
  return source instanceof Uint8Array && isArrowFileFormat(source)
    ? decodeIPCFile(source)
    : decodeIPCStream(source);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants