index.d.ts 788 B

123456789101112131415161718192021222324252627
  1. import { fileSync, dirSync, tmpNameSync, setGracefulCleanup } from "tmp";
  2. import { FileOptions, DirOptions, TmpNameOptions } from "tmp";
  3. export interface DirectoryResult {
  4. path: string;
  5. cleanup: () => Promise<void>;
  6. }
  7. export interface FileResult extends DirectoryResult {
  8. fd: number;
  9. }
  10. export function file(options?: FileOptions): Promise<FileResult>;
  11. export function withFile<T>(
  12. fn: (result: FileResult) => Promise<T>,
  13. options?: FileOptions
  14. ): Promise<T>;
  15. export function dir(options?: DirOptions): Promise<DirectoryResult>;
  16. export function withDir<T>(
  17. fn: (results: DirectoryResult) => Promise<T>,
  18. options?: DirOptions
  19. ): Promise<T>;
  20. export function tmpName(options?: TmpNameOptions): Promise<string>;
  21. export { fileSync, dirSync, tmpNameSync, setGracefulCleanup };