dax
Version:
Cross platform shell tools inspired by zx.
20 lines • 870 B
TypeScript
/**
* Fixed-capacity ring buffer of bytes. Used to retain the trailing N bytes of
* a stream so they can be surfaced when a command fails — the live writes go
* to wherever the user piped the stream, and the ring tap silently keeps
* a copy of the last `capacity` bytes regardless of where output is going.
*
* Differs from {@link LineRingBuffer} in that it caps by *total bytes* rather
* than by entry count, and is backed by a single `Uint8Array` so each `push`
* is O(n) on the bytes written without per-entry allocation.
*/
export declare class ByteRingBuffer {
#private;
readonly capacity: number;
constructor(capacity: number);
get size(): number;
push(data: Uint8Array): void;
/** Return the retained bytes, oldest first, as a freshly allocated array. */
toBytes(): Uint8Array;
}
//# sourceMappingURL=byteRingBuffer.d.ts.map