aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/lib/ts/truncate.worker.ts
blob: 52eebb788f49e9d118a256b5953c0d39f2795e8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import type { TruncateRequest, TruncateResponse } from '../types/truncate-worker';


onmessage = async (message: MessageEvent<TruncateRequest>) => {
	const file = message.data.file;
	const buffer = await file.arrayBuffer();
	const truncated = buffer.slice(0, message.data.size);

	postMessage({ file: truncated } as TruncateResponse);
}