blob: 9ddf63c1e5be5f6937d4e185a77926973d084f85 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
|
import type { TruncateRequest, TruncateResponse } from '../types/truncate-worker';
onmessage = async (message: MessageEvent<TruncateRequest>) => {
console.log('File received. Truncating...');
const file = message.data.file;
const buffer = await file.arrayBuffer();
const truncated = buffer.slice(0, message.data.size);
postMessage({ file: truncated } as TruncateResponse);
};
|