cs2-inspect-lib
Version:
Enhanced CS2 Inspect URL library with full protobuf support, validation, and error handling
75 lines • 1.99 kB
TypeScript
/**
* Enhanced protobuf writer with error handling and validation
*/
import { EconItem, Sticker, CS2InspectConfig } from './types';
/**
* Enhanced protobuf writer with comprehensive error handling
*/
export declare class ProtobufWriter {
private buffer;
private pos;
private capacity;
private config;
constructor(initialCapacity?: number, config?: CS2InspectConfig);
/**
* Ensures buffer has enough capacity, growing if necessary
*/
private ensureCapacity;
/**
* Writes a varint with bounds checking
*/
writeVarint(value: number): void;
/**
* Writes a 64-bit varint
*/
writeVarint64(value: number | bigint): void;
/**
* Writes a signed 32-bit integer using ZigZag encoding
*/
writeSInt32(value: number): void;
/**
* Writes a protobuf tag
*/
writeTag(fieldNumber: number, wireType: number): void;
/**
* Writes a float value
*/
writeFloat(value: number): void;
/**
* Writes a string with length prefix
*/
writeString(value: string): void;
/**
* Writes length-delimited bytes
*/
writeLengthDelimited(bytes: Uint8Array): void;
/**
* Returns the encoded bytes
*/
getBytes(): Uint8Array;
/**
* Gets current position
*/
getPosition(): number;
/**
* Resets the writer for reuse
*/
reset(): void;
/**
* Encodes a sticker to protobuf bytes
*/
static encodeSticker(sticker: Sticker, config?: CS2InspectConfig): Uint8Array;
/**
* Encodes an EconItem to protobuf bytes
*/
static encodeItemData(item: EconItem, config?: CS2InspectConfig): Uint8Array;
/**
* CRC32 calculation for checksum
*/
static crc32(data: Uint8Array): number;
/**
* Creates a complete inspect URL from an EconItem
*/
static createInspectUrl(item: EconItem, config?: CS2InspectConfig): string;
}
//# sourceMappingURL=protobuf-writer.d.ts.map