fix: make OCR portable and reliable across AMD64 and ARM64 (#519)

* fix: make OCR portable and reliable

* fix: harden OCR installation portability

* fix: pin OCR partials across downloads

* fix: make OCR execution reliably asynchronous

* fix: harden OCR portability and docs routes

* fix: preserve decoder and docs safeguards
This commit is contained in:
SnapOtter
2026-07-15 03:34:24 +08:00
committed by GitHub
parent 58121f205f
commit 991c981529
409 changed files with 67151 additions and 8076 deletions
+12 -1
View File
@@ -189,6 +189,7 @@ export async function putGenericObject(key: string, data: Buffer): Promise<void>
export async function putGenericObjectStream(
key: string,
source: AsyncIterable<Buffer>,
signal?: AbortSignal,
): Promise<void> {
const upload = new Upload({
client: getClient(),
@@ -202,7 +203,17 @@ export async function putGenericObjectStream(
Body: Readable.from(source),
},
});
await upload.done();
const abortUpload = () => {
void upload.abort().catch(() => {});
};
signal?.addEventListener("abort", abortUpload, { once: true });
if (signal?.aborted) abortUpload();
try {
await upload.done();
signal?.throwIfAborted();
} finally {
signal?.removeEventListener("abort", abortUpload);
}
}
export async function getGenericObjectStream(