blob: da750417f2f74ef6b42d904c05b2ebc0382f1fbe (
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)
}
|