netstorage
Version:
A TypeScript API and CLI for the Akamai NetStorage REST interface
38 lines (37 loc) • 1.59 kB
TypeScript
import { type NetStorageClientConfig, type NetStorageFile, type NetStorageDu } from '../../index';
type InspectKind = 'file' | 'directory' | 'any';
/**
* Inspect a NetStorage path to determine whether it is a file or directory (explicit or implicit).
*
* Attempts to `stat` the path first unless kind is explicitly `'directory'`.
* If `stat` fails with a 404 or if the path is not a file, and kind is not `'file'`,
* falls back to `du` to determine directory information.
*
* @param config - NetStorage client config.
* @param options - Object with path to inspect and optional kind filter ('file', 'directory', or 'any').
* @returns An object that may include a `file` (from stat) or `du` (from du), or both if applicable.
*/
export declare function inspectRemotePath(config: NetStorageClientConfig, options: {
path: string;
kind?: InspectKind;
}): Promise<{
file?: NetStorageFile;
du?: NetStorageDu;
}>;
/**
* Convenience wrapper to determine if a NetStorage path is a file.
*
* @param config - NetStorage client config
* @param path - Remote file path to check
* @returns True if path is a file, false otherwise
*/
export declare function isFile(config: NetStorageClientConfig, path: string): Promise<boolean>;
/**
* Convenience wrapper to determine if a NetStorage path is a directory.
*
* @param config - NetStorage client config
* @param path - Remote directory path to check
* @returns True if path is a directory, false otherwise
*/
export declare function isDirectory(config: NetStorageClientConfig, path: string): Promise<boolean>;
export {};