Spaces:
Configuration error
Configuration error
Download node_modules/capnp-ts/src/serialization/object-size.ts from W404NET/Telegram-Chat-Bot: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/W404NET/Telegram-Chat-Bot/resolve/main/node_modules/capnp-ts/src/serialization/object-size.ts
- Command line
-
hf download hf://spaces/W404NET/Telegram-Chat-Bot/node_modules/capnp-ts/src/serialization/object-size.ts
-
curl -L -o object-size.ts https://huggingface.co/spaces/W404NET/Telegram-Chat-Bot/resolve/main/node_modules/capnp-ts/src/serialization/object-size.ts
1.19 kB
| /** | |
| * @author jdiaz5513 | |
| */ | |
| import initTrace from "debug"; | |
| import * as _ from "../util"; | |
| const trace = initTrace("capnp:object-size"); | |
| trace("load"); | |
| /** | |
| * A simple object that describes the size of a struct. | |
| * | |
| * @export | |
| * @class ObjectSize | |
| */ | |
| export class ObjectSize { | |
| /** The number of bytes required for the data section. */ | |
| readonly dataByteLength: number; | |
| /** The number of pointers in the object. */ | |
| readonly pointerLength: number; | |
| constructor(dataByteLength: number, pointerCount: number) { | |
| this.dataByteLength = dataByteLength; | |
| this.pointerLength = pointerCount; | |
| } | |
| toString(): string { | |
| return _.format( | |
| "ObjectSize_dw:%d,pc:%d", | |
| getDataWordLength(this), | |
| this.pointerLength | |
| ); | |
| } | |
| } | |
| export function getByteLength(o: ObjectSize): number { | |
| return o.dataByteLength + o.pointerLength * 8; | |
| } | |
| export function getDataWordLength(o: ObjectSize): number { | |
| return o.dataByteLength / 8; | |
| } | |
| export function getWordLength(o: ObjectSize): number { | |
| return o.dataByteLength / 8 + o.pointerLength; | |
| } | |
| export function padToWord(o: ObjectSize): ObjectSize { | |
| return new ObjectSize(_.padToWord(o.dataByteLength), o.pointerLength); | |
| } | |