import type { AbsolutePath, GetOptions, Readable } from "@zarrita/storage"; import { createCodecPipeline } from "./codecs.js"; import type { ArrayMetadata, Attributes, Chunk, DataType, GroupMetadata, Scalar, TypedArrayConstructor } from "./metadata.js"; import { type DataTypeQuery, type NarrowDataType } from "./util.js"; export declare class Location { readonly store: Store; readonly path: AbsolutePath; constructor(store: Store, path?: AbsolutePath); resolve(path: string): Location; } export declare function root(store: Store): Location; export declare function root(): Location>; export declare class Group extends Location { #private; readonly kind = "group"; constructor(store: Store, path: AbsolutePath, metadata: GroupMetadata); get attrs(): Attributes; } declare const CONTEXT_MARKER: unique symbol; export declare function getContext(obj: { [CONTEXT_MARKER]: T; }): T; /** For internal use only, and is subject to change. */ interface ArrayContext { kind: "sharded" | "regular"; /** The codec pipeline for this array. */ codec: ReturnType>; /** Encode a chunk key from chunk coordinates. */ encodeChunkKey(chunkCoords: number[]): string; /** The TypedArray constructor for this array chunks. */ TypedArray: TypedArrayConstructor; /** * Get the strides for a given output shape, using the array's native order. * `axes` lists the original axis indices the shape corresponds to (used to * project a transpose order onto a dimension-reducing selection); omit it * for a full-rank shape. */ getStrides(shape: number[], axes?: number[]): number[]; /** The fill value for this array. */ fillValue: Scalar | null; /** A function to get the bytes for a given chunk. */ getChunkBytes(chunkCoords: number[], options?: GetOptions): Promise; /** The chunk shape for this array. */ chunkShape: number[]; } export declare class Array extends Location { #private; readonly kind = "array"; [CONTEXT_MARKER]: ArrayContext; constructor(store: Store, path: AbsolutePath, metadata: ArrayMetadata); get attrs(): Attributes; get dimensionNames(): string[] | undefined; get fillValue(): Scalar | null; get shape(): number[]; get chunks(): number[]; get dtype(): Dtype; getChunk(chunkCoords: number[], options?: GetOptions, opts?: { useSharedArrayBuffer?: boolean; }): Promise>; /** * A helper method to narrow `zarr.Array` Dtype. * * ```typescript * let arr: zarr.Array = zarr.open(store, { kind: "array" }); * * // Option 1: narrow by scalar type (e.g. "bool", "raw", "bigint", "number") * if (arr.is("bigint")) { * // zarr.Array<"int64" | "uint64", FetchStore> * } * * // Option 3: exact match * if (arr.is("float32")) { * // zarr.Array<"float32", FetchStore, "/"> * } * ``` */ is(query: Query): this is Array, Store>; } export {}; //# sourceMappingURL=hierarchy.d.ts.map