20 lines
529 B
TypeScript
20 lines
529 B
TypeScript
import { decode } from 'simple-yenc'
|
|
|
|
export class YencFile {
|
|
private buffer: Buffer | null = null
|
|
|
|
public processPart(partBuffer: Buffer) {
|
|
// This is a simplified implementation.
|
|
// simple-yenc's decode function is synchronous and works on a full buffer.
|
|
// A more complex implementation would handle multi-part decoding.
|
|
this.buffer = decode(partBuffer)
|
|
}
|
|
|
|
public getBuffer(): Buffer {
|
|
if (!this.buffer) {
|
|
throw new Error('No data has been processed yet.')
|
|
}
|
|
return this.buffer
|
|
}
|
|
}
|