/**
 * Represents a stream reader for reading a file in chunks.
 */
import { InboxApi, StoreApi } from "..";
export declare const FILE_DEFAULT_CHUNK_SIZE = 1048576;
export declare class StreamReader {
    private _handle;
    private _offset;
    private _api;
    private readonly chunkSize;
    hasDataToRead: boolean;
    /**
     * Creates an instance of StreamReader.
     *
     * @param {number} handle - The file handle.
     * @param {StoreApi} api {@link StoreApi `StoreApi`} instance
     */
    constructor(handle: number, api: StoreApi | InboxApi, chunkSize?: number);
    static readFile(api: InboxApi | StoreApi, fileID: string, chunkSize?: number): Promise<StreamReader>;
    /**
     * Reads the next chunk of the file.
     *
     * @returns {Promise<boolean>} A promise that resolves to true if there are more chunks to read, or false if the end of the file is reached.
     */
    [Symbol.asyncIterator](): AsyncGenerator<readonly [Uint8Array<ArrayBufferLike>, number], void, unknown>;
    readNextChunk(): Promise<Uint8Array>;
    getFileContent(): Promise<Uint8Array>;
    /**
     * Aborts the reading process and closes the file handle.
     *
     * @returns {Promise<string>} A promise that resolves when the file handle is closed.
     */
    abort(): Promise<string>;
    /**
     * Closes the file handle.
     *
     * @returns {Promise<string>} A promise that resolves when the file handle is closed and returns file ID.
     */
    close(): Promise<string>;
}
/**
 * Represents a file stream uploader for uploading a Browser FileHandle in chunks.
 */
interface FileContainerApi {
    writeToFile: (chunk: Uint8Array) => Promise<void>;
    closeFile: () => Promise<string>;
}
export declare class FileUploader {
    private readonly _size;
    private offset;
    private readonly _api;
    private _reader;
    /**
     * Creates an instance of FileUploader.
     *
     * @param {number} handle - The file handle.
     * @param {File} file - The data (file content) to upload.
     * @param {StoreApi} api {@link StoreApi `StoreApi`} instance
     */
    constructor(file: File, api: FileContainerApi);
    static uploadStoreFile({ storeApi, storeId, file, privateMeta, publicMeta, }: {
        storeId: string;
        file: File;
        storeApi: StoreApi;
        publicMeta?: Uint8Array;
        privateMeta?: Uint8Array;
    }): Promise<FileUploader>;
    static uploadInboxFile({ inboxApi, inboxHandle, preparedFileUpload, }: {
        inboxHandle: number;
        preparedFileUpload: {
            file: File;
            handle: number;
        };
        inboxApi: InboxApi;
    }): Promise<FileUploader>;
    static prepareInboxUpload({ inboxApi, file, privateMeta, publicMeta, }: {
        inboxApi: InboxApi;
        file: File;
        publicMeta?: Uint8Array;
        privateMeta?: Uint8Array;
    }): Promise<{
        file: File;
        handle: number;
    }>;
    /**
     * Gets the progress of uploading the file as a percentage.
     *
     * @returns {number} The progress percentage.
     */
    get progress(): number;
    /**
     * Sends the next chunk of the file data to the server.
     *
     * @returns {Promise<boolean>} A promise that resolves to true if there are more chunks to send, or false if all data has been sent.
     */
    sendNextChunk(): Promise<boolean>;
    uploadFileContent(): Promise<string>;
    /**
     * Aborts the uploading process, closes the file handle, and deletes the uploaded part of the file.
     *
     * @returns {Promise<void>} A promise that resolves when the file handle is closed and the uploaded part is deleted.
     */
    abort(): Promise<void>;
    /**
     * Closes the file handle.
     *
     * @returns {Promise<string>} A promise that resolves when the file handle is closed and returns file ID.
     */
    close(): Promise<string>;
}
/**
 * Downloads a file from the server.
 *
 * @param {StoreApi|InboxApi} api - The API instance used for file operations.
 * @param {string} fileId - The ID of the file to download.
 * @param {string} [targetFileName] - The target file name for saving the downloaded file.
 * @returns {Promise<void>} A promise that resolves when the download is complete.
 */
export declare function downloadFile(api: StoreApi | InboxApi, fileId: string, targetFileName?: string): Promise<void>;
export {};
