Add NullTarget

This commit is contained in:
Vanilagy
2025-09-02 17:20:09 +02:00
parent a769d099e2
commit 55dd8cdb4c
5 changed files with 78 additions and 4 deletions
+21
View File
@@ -459,3 +459,24 @@ export class StreamTargetWriter extends Writer {
return this.writer?.close();
}
}
export class NullTargetWriter extends Writer {
private pos = 0;
write(data: Uint8Array) {
this.maybeTrackWrites(data);
this.pos += data.byteLength;
}
getPos() {
return this.pos;
}
seek(newPos: number) {
this.pos = newPos;
}
async flush() {}
async finalize() {}
async close() {}
}