slopus--happy
98e40dac97
CLI Smoke Test / smoke-test-linux (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-linux (24) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (24) (push) Has been cancelled
Expo App TypeScript typecheck / typecheck (push) Has been cancelled
13 行
454 B
TypeScript
13 行
454 B
TypeScript
/**
|
|
* Read file bytes from a URI — web implementation.
|
|
* Uses fetch() on blob: and data: URIs returned by expo-image-picker on web.
|
|
*/
|
|
export async function readFileBytes(uri: string): Promise<Uint8Array> {
|
|
const response = await fetch(uri);
|
|
if (!response.ok) {
|
|
throw new Error(`readFileBytes: fetch failed with status ${response.status}`);
|
|
}
|
|
const buffer = await response.arrayBuffer();
|
|
return new Uint8Array(buffer);
|
|
}
|