MCPcopy Create free account
hub / github.com/middleapi/orpc / readAsBuffer

Function readAsBuffer

packages/shared/src/buffer.ts:6–13  ·  view source on GitHub ↗
(source: Pick<Blob, 'arrayBuffer' | 'bytes'>)

Source from the content-addressed store, hash-verified

4 * Prefers the newer `.bytes` method when available as it more efficient but not widely supported yet.
5 */
6export function readAsBuffer(source: Pick<Blob, 'arrayBuffer' | 'bytes'>): Promise<ArrayBuffer | Uint8Array> {
7 if (typeof source.bytes === 'function') {
8 // eslint-disable-next-line ban/ban
9 return source.bytes()
10 }
11
12 return (source as Pick<Blob, 'arrayBuffer'>).arrayBuffer()
13}

Callers 5

constructorMethod · 0.90
buffer.test.tsFile · 0.90
messageMethod · 0.90
upgradeMethod · 0.90
encodeRawMessageFunction · 0.90

Calls 2

bytesMethod · 0.80
arrayBufferMethod · 0.80

Tested by

no test coverage detected