mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user