import type { AbsolutePath, Readable } from "@zarrita/storage"; import type { ArrayMetadata, Chunk, DataType, GroupMetadata, Scalar, TypedArrayConstructor } from "./metadata.js"; import { type DataTypeQuery, type NarrowDataType } from "./util.js"; import { create_codec_pipeline } from "./codecs.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(): import("./metadata.js").Attributes; } declare const CONTEXT_MARKER: unique symbol; export declare function get_context(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. */ encode_chunk_key(chunk_coords: number[]): string; /** The TypedArray constructor for this array chunks. */ TypedArray: TypedArrayConstructor; /** A function to get the strides for a given shape, using the array order */ get_strides(shape: number[], order?: "C" | "F"): number[]; /** The fill value for this array. */ fill_value: Scalar | null; /** A function to get the bytes for a given chunk. */ get_chunk_bytes(chunk_coords: number[], options?: Parameters[1]): Promise; /** The chunk shape for this array. */ chunk_shape: number[]; } export declare class Array extends Location { #private; readonly kind = "array"; [CONTEXT_MARKER]: ArrayContext; constructor(store: Store, path: AbsolutePath, metadata: ArrayMetadata); get attrs(): import("./metadata.js").Attributes; get shape(): number[]; get chunks(): number[]; get dtype(): Dtype; getChunk(chunk_coords: number[], options?: Parameters[1]): 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 {};