Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@tokenizer/token/index.d.ts
1129 views
1
/**
2
* Read-only token
3
* See https://github.com/Borewit/strtok3 for more information
4
*/
5
export interface IGetToken<Value, Array extends Uint8Array = Uint8Array> {
6
7
/**
8
* Length of encoded token in bytes
9
*/
10
len: number;
11
12
/**
13
* Decode value from buffer at offset
14
* @param array - Uint8Array to read the decoded value from
15
* @param offset - Decode offset
16
* @return decoded value
17
*/
18
get(array: Array, offset: number): Value;
19
}
20
21
export interface IToken<Value, Array extends Uint8Array = Uint8Array> extends IGetToken<Value, Array> {
22
/**
23
* Encode value to buffer
24
* @param array - Uint8Array to write the encoded value to
25
* @param offset - Buffer write offset
26
* @param value - Value to decode of type T
27
* @return offset plus number of bytes written
28
*/
29
put(array: Array, offset: number, value: Value): number
30
}
31
32