Skip to content

Commit 60c9b4e

Browse files
committed
fix: full size
1 parent 910ce08 commit 60c9b4e

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/classes/audioClip.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ export class AudioClip extends AssetBase {
189189
this.format = recognizeFile(this.data, magicNumbers) || 'fsb';
190190
}
191191

192+
get size() {
193+
return this.__info.bytesSize + Number(this.audioSize);
194+
}
195+
192196
getAudio(): AudioClipGetResult {
193197
return {
194198
format: this.format,

src/classes/texture2d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class Texture2D extends AssetBase implements GetImage {
3030
readonly height: number;
3131
readonly textureFormat: number;
3232
readonly streamData?: StreamInfo;
33+
readonly dataSize: number;
3334
private readonly image: TextureDecoder;
3435

3536
constructor(info: ObjectInfo, r: ArrayBufferReader) {
@@ -71,9 +72,14 @@ export class Texture2D extends AssetBase implements GetImage {
7172
? this.readStreamInfo(r)
7273
: undefined;
7374
const data = this.streamData?.path ? this.readData(this.streamData) : r.readBuffer(dataSize);
75+
this.dataSize = this.streamData?.size ?? dataSize;
7476
this.image = new TextureDecoder(this, new Uint8Array(data));
7577
}
7678

79+
get size() {
80+
return this.__info.bytesSize + this.dataSize;
81+
}
82+
7783
getImage() {
7884
return getJimpPNG(this.getImageJimp());
7985
}

0 commit comments

Comments
 (0)