Files
NapCatQQ/.pnpm-store/v3/files/32/c64584c436e91f9cfb47db9e0d1d6a0337a33e1269b49525e3cb11ad9b59a76f0f1a0534cd6b68f10139d51e171742dcb5af01d77d459822464f1221660e23
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

103 lines
2.8 KiB
Plaintext

import type { BinaryReadOptions, IBinaryReader } from "./binary-format-contract";
import { WireType } from "./binary-format-contract";
import { PbLong, PbULong } from "./pb-long";
/**
* Make options for reading binary data form partial options.
*/
export declare function binaryReadOptions(options?: Partial<BinaryReadOptions>): Readonly<BinaryReadOptions>;
/**
* TextDecoderLike is the subset of the TextDecoder API required by protobuf-ts.
*/
interface TextDecoderLike {
decode(input?: Uint8Array): string;
}
export declare class BinaryReader implements IBinaryReader {
/**
* Current position.
*/
pos: number;
/**
* Number of bytes available in this reader.
*/
readonly len: number;
private readonly buf;
private readonly view;
private readonly textDecoder;
constructor(buf: Uint8Array, textDecoder?: TextDecoderLike);
/**
* Reads a tag - field number and wire type.
*/
tag(): [number, WireType];
/**
* Skip one element on the wire and return the skipped data.
* Supports WireType.StartGroup since v2.0.0-alpha.23.
*/
skip(wireType: WireType): Uint8Array;
protected varint64: () => [number, number];
/**
* Throws error if position in byte array is out of range.
*/
protected assertBounds(): void;
/**
* Read a `uint32` field, an unsigned 32 bit varint.
*/
uint32: () => number;
/**
* Read a `int32` field, a signed 32 bit varint.
*/
int32(): number;
/**
* Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
*/
sint32(): number;
/**
* Read a `int64` field, a signed 64-bit varint.
*/
int64(): PbLong;
/**
* Read a `uint64` field, an unsigned 64-bit varint.
*/
uint64(): PbULong;
/**
* Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
*/
sint64(): PbLong;
/**
* Read a `bool` field, a variant.
*/
bool(): boolean;
/**
* Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
*/
fixed32(): number;
/**
* Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
*/
sfixed32(): number;
/**
* Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
*/
fixed64(): PbULong;
/**
* Read a `fixed64` field, a signed, fixed-length 64-bit integer.
*/
sfixed64(): PbLong;
/**
* Read a `float` field, 32-bit floating point number.
*/
float(): number;
/**
* Read a `double` field, a 64-bit floating point number.
*/
double(): number;
/**
* Read a `bytes` field, length-delimited arbitrary data.
*/
bytes(): Uint8Array;
/**
* Read a `string` field, length-delimited data converted to UTF-8 text.
*/
string(): string;
}
export {};