import type { Readable } from 'node:stream';
/**
 * Options for pulling files/folders
 */
export interface AfcPullOptions {
    recursive?: boolean;
    overwrite?: boolean;
    onEntry?: (remotePath: string, localPath: string, isDirectory: boolean) => Promise<void>;
}
/**
 * Options for creating an AFC client for app container access
 */
export interface CreateForAppOptions {
    containerType?: string | null;
    skipDocumentsCheck?: boolean;
}
/**
 * Unified AFC Client
 *
 * Provides a unified interface for file operations on iOS devices,
 * automatically handling the differences between iOS < 18 (appium-ios-device)
 * and iOS 18 and above (appium-ios-remotexpc).
 */
export declare class AfcClient {
    private readonly service;
    private readonly _isRemoteXPC;
    private constructor();
    /**
     * Check if this client is using RemoteXPC
     */
    private get isRemoteXPC();
    /**
     * Get service as RemoteXPC AFC service
     */
    private get remoteXPCAfcService();
    /**
     * Get service as iOS Device AFC service
     */
    private get iosDeviceAfcService();
    /**
     * Create an AFC client for device
     *
     * @param udid - Device UDID
     * @param useRemoteXPC - Whether to use remotexpc (use isIos18OrNewer(opts) to determine)
     * @returns AFC client instance
     */
    static createForDevice(udid: string, useRemoteXPC: boolean): Promise<AfcClient>;
    /**
     * Create an AFC client for app container access
     *
     * @param udid - Device UDID
     * @param bundleId - App bundle identifier
     * @param useRemoteXPC - Whether to use remotexpc (use isIos18OrNewer(opts) to determine)
     * @param options - Optional configuration for container access
     * @returns AFC client instance
     */
    static createForApp(udid: string, bundleId: string, useRemoteXPC: boolean, options?: CreateForAppOptions): Promise<AfcClient>;
    /**
     * Check if a path is a directory
     */
    isDirectory(path: string): Promise<boolean>;
    /**
     * List directory contents
     */
    listDirectory(path: string): Promise<string[]>;
    /**
     * Create a directory
     */
    createDirectory(path: string): Promise<void>;
    /**
     * Delete a directory or file
     */
    deleteDirectory(path: string): Promise<void>;
    /**
     * Get file contents as a buffer
     */
    getFileContents(path: string): Promise<Buffer>;
    /**
     * Set file contents from a buffer
     */
    setFileContents(path: string, data: Buffer): Promise<void>;
    /**
     * Write file contents from a readable stream
     */
    writeFromStream(path: string, stream: Readable): Promise<void>;
    /**
     * Pull files/folders from device to local filesystem.
     * Uses the appropriate mechanism (walkDir for ios-device, pull for remotexpc).
     *
     * @param remotePath - Remote path on the device (file or directory)
     * @param localPath - Local destination path
     * @param options - Pull options (recursive, overwrite, onEntry)
     */
    pull(remotePath: string, localPath: string, options?: AfcPullOptions): Promise<void>;
    /**
     * Close the AFC service connection
     */
    close(): Promise<void>;
    /**
     * Create a read stream for a file (internal use only).
     */
    private createReadStream;
    /**
     * Internal implementation of pull for ios-device using walkDir.
     * Walks the remote directory tree and pulls files to local filesystem.
     */
    private pullWithWalkDir;
    /** Pull a single remote file when walkDir target is not a directory. */
    private pullWalkDirSingleFile;
    /** Creates local root folder and notifies onEntry for the directory root. */
    private prepareWalkPullDirectoryRoot;
    /**
     * Returns a waiter that blocks until fewer than MAX_IO_CHUNK_SIZE pulls are in flight.
     * Uses Promise.race over in-flight pull completions to free a slot.
     */
    private createBoundedPullSlotWaiter;
    private processWalkDirPullEntry;
    /**
     * Pull one remote file to a local path using streams (ios-device AFC only).
     * Resolves when the write stream closes or when streaming is skipped after an error.
     */
    private pullRemoteFileToLocalViaStreams;
    /**
     * Check if local file exists and should not be overwritten.
     * Throws an error if the file exists and overwrite is false.
     *
     * @param localPath - Local file path to check
     * @param overwrite - Whether to allow overwriting existing files
     */
    private checkOverwrite;
    /**
     * Pull a single file from device to local filesystem using streams.
     * This method only works for ios-device.
     *
     * @param remotePath - Remote file path
     * @param localPath - Local destination path
     */
    private pullSingleFile;
    /**
     * Check if a local path exists and is a directory.
     */
    private isLocalDirectory;
}
//# sourceMappingURL=afc-client.d.ts.map