summaryrefslogtreecommitdiff
path: root/node_modules/blake3-wasm/esm/base/hash-reader.d.ts
diff options
context:
space:
mode:
authorakiyamn2023-09-24 23:22:21 +1000
committerakiyamn2023-09-24 23:22:21 +1000
commit4e87195739f2a5d9a05451b48773c8afdc680765 (patch)
tree9cba501844a4a11dcbdffc4050ed8189561c55ed /node_modules/blake3-wasm/esm/base/hash-reader.d.ts
downloadprice-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.tar.gz
price-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.zip
Initial commit (by create-cloudflare CLI)
Diffstat (limited to 'node_modules/blake3-wasm/esm/base/hash-reader.d.ts')
-rw-r--r--node_modules/blake3-wasm/esm/base/hash-reader.d.ts61
1 files changed, 61 insertions, 0 deletions
diff --git a/node_modules/blake3-wasm/esm/base/hash-reader.d.ts b/node_modules/blake3-wasm/esm/base/hash-reader.d.ts
new file mode 100644
index 0000000..ad6a8fa
--- /dev/null
+++ b/node_modules/blake3-wasm/esm/base/hash-reader.d.ts
@@ -0,0 +1,61 @@
+import { IDisposable } from './disposable';
+/**
+ * The maximum number of bytes that can be read from the hash.
+ *
+ * Calculated out 2^64-1, since `Xn` syntax (for `Xn ** Yn`) requires TS
+ * targeting esnext/es2020 which includes features that Node 10 doesn't
+ * yet supported.
+ */
+export declare const maxHashBytes: bigint;
+/**
+ * The HashReader is a type returned from any of the hash functions. It can
+ */
+export interface IHashReader<T> extends IDisposable {
+ /**
+ * Returns the position of the reader in the hash. Can be written to to seek.
+ */
+ position: bigint;
+ /**
+ * Reads data from the hash into the target array. The target will always
+ * be completely filled with data.
+ */
+ readInto(target: Uint8Array): void;
+ /**
+ * Reads and returns the given number of bytes from the hash, advancing
+ * the position of the reader.
+ */
+ read(bytes: number): T;
+}
+/**
+ * Underlying native or wasm module code backing the reader.
+ * @hidden
+ */
+export interface IInternalReader {
+ free?(): void;
+ fill(target: Uint8Array): void;
+ set_position(position: bigint): void;
+}
+/**
+ * Base hash reader implementation.
+ */
+export declare abstract class BaseHashReader<T extends Uint8Array> implements IHashReader<T> {
+ private reader;
+ private pos;
+ get position(): bigint;
+ set position(value: bigint);
+ constructor(reader: IInternalReader);
+ /**
+ * @inheritdoc
+ */
+ readInto(target: Uint8Array): void;
+ /**
+ * @inheritdoc
+ */
+ read(bytes: number): T;
+ /**
+ * @inheritdoc
+ */
+ dispose(): void;
+ protected abstract alloc(bytes: number): T;
+ private boundsCheck;
+}