From 13d465c1c45e649a702457d67476694aeb553704 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Wed, 27 Sep 2023 16:16:10 -0500 Subject: Get rid of crc32, truncate instead Signed-off-by: Matt Strapp --- app/src/lib/ts/truncate.worker.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/src/lib/ts/truncate.worker.ts (limited to 'app/src/lib/ts/truncate.worker.ts') diff --git a/app/src/lib/ts/truncate.worker.ts b/app/src/lib/ts/truncate.worker.ts new file mode 100644 index 0000000..52eebb7 --- /dev/null +++ b/app/src/lib/ts/truncate.worker.ts @@ -0,0 +1,10 @@ +import type { TruncateRequest, TruncateResponse } from '../types/truncate-worker'; + + +onmessage = async (message: MessageEvent) => { + const file = message.data.file; + const buffer = await file.arrayBuffer(); + const truncated = buffer.slice(0, message.data.size); + + postMessage({ file: truncated } as TruncateResponse); +} \ No newline at end of file -- cgit v1.2.3