mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-02 21:33:52 +02:00
Move RiffWriter into separate file
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { Writer } from '../writer';
|
||||
|
||||
export class RiffWriter {
|
||||
private helper = new Uint8Array(8);
|
||||
private helperView = new DataView(this.helper.buffer);
|
||||
|
||||
constructor(private writer: Writer) {}
|
||||
|
||||
writeU32(value: number) {
|
||||
this.helperView.setUint32(0, value, true);
|
||||
this.writer.write(this.helper.subarray(0, 4));
|
||||
}
|
||||
|
||||
writeU16(value: number) {
|
||||
this.helperView.setUint16(0, value, true);
|
||||
this.writer.write(this.helper.subarray(0, 2));
|
||||
}
|
||||
|
||||
writeAscii(text: string) {
|
||||
this.writer.write(new TextEncoder().encode(text));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user