start of performance

This commit is contained in:
tresabhi committed 2026-08-11 20:03:57 -05:00
1 parent 08c909fbe2
commit b3e439669b
11 files changed
+64 -87

No files matched your search

-51
View File
@@ -1,51 +0,0 @@
import { times } from 'lodash-es';
import { ReadStream, WriteStream } from './buffer';
export class DidsReadStream extends ReadStream {
dids() {
this.magic();
this.header();
return this.body();
}
magic() {
const magic = this.utf8(4);
if (magic !== 'DIDS') {
throw new Error(`Invalid DIDS magic number: "${magic}"`);
}
}
header() {
return {
version: this.uint16(),
};
}
body() {
const count = this.uint32();
return times(count, () => this.uint32());
}
}
export class DidsWriteStream extends WriteStream {
dids(ids: number[]) {
this.magic();
this.header();
this.body(ids);
return this;
}
magic() {
this.utf8('DIDS');
}
header() {
this.uint16(1);
}
body(ids: number[]) {
this.uint32(ids.length);
ids.forEach((id) => this.uint32(id));
}
}
+9 -11
View File
@@ -1,11 +1,9 @@
export * from './buffer';
export * from './bufferToBigInt';
export * from './dds';
export * from './dids';
export * from './pvr';
export * from './rts';
export * from './sc2';
export * from './scg';
export * from './scpg';
export * from './windows';
export * from "./buffer";
export * from "./bufferToBigInt";
export * from "./dds";
export * from "./pvr";
export * from "./rts";
export * from "./sc2";
export * from "./scg";
export * from "./scpg";
export * from "./windows";