/**
* This file is part of the @egodigital/egoose distribution.
* Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
*
* @egodigital/egoose is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.
*
* @egodigital/egoose is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*/
///
import * as fs from 'fs-extra';
import { IOptions } from 'fast-glob/out/managers/options';
import { EntryItem } from 'fast-glob/out/types/entries';
/**
* A value, that can be used as file system path.
*/
export declare type FileSystemPath = string | Buffer;
/**
* Options for temp file execution.
*/
export interface TempFileOptions {
/**
* The custom directory for the file.
*/
dir?: string;
/**
* Keep file or delete it after execution.
*/
keep?: boolean;
/**
* Prefix for the filename.
*/
prefix?: string;
/**
* Suffix for the filename.
*/
suffix?: string;
}
/**
* Promise version of 'fs.exists()'.
*
* @param {string} path The path.
*
* @return {Promise} The promise that indicates if path exists or not.
*/
export declare function exists(path: fs.PathLike): Promise;
/**
* Scans for files.
*
* @param {string|string[]} patterns One or more glob patterns.
* @param {Partial>} [opts] Custom options.
*
* @return {Promise} The promise with the found items.
*/
export declare function glob(patterns: string | string[], opts?: Partial>): Promise;
/**
* Scans for files (synchronious).
*
* @param {string|string[]} patterns One or more glob patterns.
* @param {Partial>} [opts] Custom options.
*
* @return {EntryItem[]} The found items.
*/
export declare function globSync(patterns: string | string[], opts?: Partial>): EntryItem[];
/**
* Checks if a path represents an existing block device.
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstat()' function instead of 'fs.stat()'.
*
* @return {Promise} The promise with the boolean that represents if path is a block device or not.
*/
export declare function isBlockDevice(path: FileSystemPath, useLSTAT?: boolean): Promise;
/**
* Checks if a path represents an existing block device (synchronous).
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstatSync()' function instead of 'fs.statSync()'.
*
* @return {boolean} The boolean that represents if path is a block device or not.
*/
export declare function isBlockDeviceSync(path: FileSystemPath, useLSTAT?: boolean): boolean;
/**
* Checks if a path represents an existing block device.
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstat()' function instead of 'fs.stat()'.
*
* @return {Promise} The promise with the boolean that represents if path is a block device or not.
*/
export declare function isCharDevice(path: FileSystemPath, useLSTAT?: boolean): Promise;
/**
* Checks if a path represents an existing character device (synchronous).
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstatSync()' function instead of 'fs.statSync()'.
*
* @return {boolean} The boolean that represents if path is a character device or not.
*/
export declare function isCharDeviceSync(path: FileSystemPath, useLSTAT?: boolean): boolean;
/**
* Checks if a path represents an existing FIFO.
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstat()' function instead of 'fs.stat()'.
*
* @return {Promise} The promise with the boolean that represents if path is a FIFO or not.
*/
export declare function isFIFO(path: FileSystemPath, useLSTAT?: boolean): Promise;
/**
* Checks if a path represents an existing FIFO (synchronous).
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstatSync()' function instead of 'fs.statSync()'.
*
* @return {boolean} The boolean that represents if path is a FIFO or not.
*/
export declare function isFIFOSync(path: FileSystemPath, useLSTAT?: boolean): boolean;
/**
* Checks if a path represents an existing directory.
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstat()' function instead of 'fs.stat()'.
*
* @return {Promise} The promise with the boolean that represents if path is a directory or not.
*/
export declare function isDir(path: FileSystemPath, useLSTAT?: boolean): Promise;
/**
* Checks if a path represents an existing directory (synchronous).
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstatSync()' function instead of 'fs.statSync()'.
*
* @return {boolean} The boolean that represents if path is a directory or not.
*/
export declare function isDirSync(path: FileSystemPath, useLSTAT?: boolean): boolean;
/**
* Checks if a path represents an existing file.
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstat()' function instead of 'fs.stat()'.
*
* @return {Promise} The promise with the boolean that represents if path is a file or not.
*/
export declare function isFile(path: FileSystemPath, useLSTAT?: boolean): Promise;
/**
* Checks if a path represents an existing file (synchronous).
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstatSync()' function instead of 'fs.statSync()'.
*
* @return {boolean} The boolean that represents if path is a file or not.
*/
export declare function isFileSync(path: FileSystemPath, useLSTAT?: boolean): boolean;
/**
* Checks if a path represents an existing socket.
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstat()' function instead of 'fs.stat()'.
*
* @return {Promise} The promise with the boolean that represents if path is a socket or not.
*/
export declare function isSocket(path: FileSystemPath, useLSTAT?: boolean): Promise;
/**
* Checks if a path represents an existing socket (synchronous).
*
* @param {FileSystemPath} path The path to check.
* @param {boolean} [useLSTAT] Use 'fs.lstatSync()' function instead of 'fs.statSync()'.
*
* @return {boolean} The boolean that represents if path is a socket or not.
*/
export declare function isSocketSync(path: FileSystemPath, useLSTAT?: boolean): boolean;
/**
* Checks if a path represents an existing symbolic link.
*
* @param {FileSystemPath} path The path to check.
*
* @return {Promise} The promise with the boolean that represents if path is a symbolic link or not.
*/
export declare function isSymLink(path: FileSystemPath): Promise;
/**
* Checks if a path represents an existing symbolic link (synchronous).
*
* @param {FileSystemPath} path The path to check.
*
* @return {boolean} The boolean that represents if path is a symbolic link or not.
*/
export declare function isSymLinkSync(path: FileSystemPath): boolean;
/**
* Executes an action for a temp file.
*
* @param {Function} action The action to invoke.
* @param {TempFileOptions} [opts] Custom options.
*
* @return {Promise} The promise with the result of the action.
*/
export declare function tempFile(action: (tmpFile: string) => Promise | TResult, opts?: TempFileOptions): Promise;
/**
* Executes an action for a temp file (sync).
*
* @param {Function} action The action to invoke.
* @param {TempFileOptions} [opts] Custom options.
*
* @return {TResult} The result of the action.
*/
export declare function tempFileSync(action: (tmpFile: string) => TResult, opts?: TempFileOptions): TResult;