From 4e87195739f2a5d9a05451b48773c8afdc680765 Mon Sep 17 00:00:00 2001 From: akiyamn Date: Sun, 24 Sep 2023 23:22:21 +1000 Subject: Initial commit (by create-cloudflare CLI) --- .../capnp-ts/src/serialization/pointers/data.d.ts | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 node_modules/capnp-ts/src/serialization/pointers/data.d.ts (limited to 'node_modules/capnp-ts/src/serialization/pointers/data.d.ts') diff --git a/node_modules/capnp-ts/src/serialization/pointers/data.d.ts b/node_modules/capnp-ts/src/serialization/pointers/data.d.ts new file mode 100644 index 0000000..0055412 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/data.d.ts @@ -0,0 +1,67 @@ +/** + * @author jdiaz5513 + */ +import { List } from "./list"; +import { Pointer } from "./pointer"; +/** + * A generic blob of bytes. Can be converted to a DataView or Uint8Array to access its contents using `toDataView()` and + * `toUint8Array()`. Use `copyBuffer()` to copy an entire buffer at once. + * + * @export + * @class Data + * @extends {List} + */ +export declare class Data extends List { + static fromPointer(pointer: Pointer): Data; + protected static _fromPointerUnchecked(pointer: Pointer): Data; + /** + * Copy the contents of `src` into this Data pointer. If `src` is smaller than the length of this pointer then the + * remaining bytes will be zeroed out. Extra bytes in `src` are ignored. + * + * @param {(ArrayBuffer | ArrayBufferView)} src The source buffer. + * @returns {void} + */ + copyBuffer(src: ArrayBuffer | ArrayBufferView): void; + /** + * Read a byte from the specified offset. + * + * @param {number} byteOffset The byte offset to read. + * @returns {number} The byte value. + */ + get(byteOffset: number): number; + /** + * Write a byte at the specified offset. + * + * @param {number} byteOffset The byte offset to set. + * @param {number} value The byte value to set. + * @returns {void} + */ + set(byteOffset: number, value: number): void; + /** + * Creates a **copy** of the underlying buffer data and returns it as an ArrayBuffer. + * + * To obtain a reference to the underlying buffer instead, use `toUint8Array()` or `toDataView()`. + * + * @returns {ArrayBuffer} A copy of this data buffer. + */ + toArrayBuffer(): ArrayBuffer; + /** + * Convert this Data pointer to a DataView representing the pointer's contents. + * + * WARNING: The DataView references memory from a message segment, so do not venture outside the bounds of the + * DataView or else BAD THINGS. + * + * @returns {DataView} A live reference to the underlying buffer. + */ + toDataView(): DataView; + toString(): string; + /** + * Convert this Data pointer to a Uint8Array representing the pointer's contents. + * + * WARNING: The Uint8Array references memory from a message segment, so do not venture outside the bounds of the + * Uint8Array or else BAD THINGS. + * + * @returns {DataView} A live reference to the underlying buffer. + */ + toUint8Array(): Uint8Array; +} -- cgit v1.2.3