UNPKG

@xec-sh/core

Version:

Universal shell execution engine

39 lines (38 loc) 1.23 kB
import type { UshEventMap, TypedEventEmitter } from '../types/events.js'; export interface TempOptions { prefix?: string; suffix?: string; dir?: string; keep?: boolean; emitter?: TypedEventEmitter<UshEventMap>; } export declare class TempFile { private options; private _path; private _cleaned; constructor(options?: TempOptions); private emitEvent; private generatePath; get path(): string; create(content?: string): Promise<void>; write(content: string): Promise<void>; append(content: string): Promise<void>; read(): Promise<string>; exists(): Promise<boolean>; cleanup(): Promise<void>; } export declare class TempDir { private options; private _path; private _cleaned; constructor(options?: TempOptions); private emitEvent; private generatePath; get path(): string; create(): Promise<void>; exists(): Promise<boolean>; file(name: string): string; cleanup(): Promise<void>; } export declare function withTempFile<T>(fn: (file: TempFile) => T | Promise<T>, options?: TempOptions): Promise<T>; export declare function withTempDir<T>(fn: (dir: TempDir) => T | Promise<T>, options?: TempOptions): Promise<T>;