filesystem.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Typing for the fields of package.json we care about
  3. */
  4. export interface PackageJson {
  5. [key: string]: string;
  6. }
  7. /**
  8. * A function that json from a file
  9. */
  10. export interface ReadJsonSync {
  11. (packageJsonPath: string): any | undefined;
  12. }
  13. export interface FileExistsSync {
  14. (name: string): boolean;
  15. }
  16. export interface FileExistsAsync {
  17. (path: string, callback: (err?: Error, exists?: boolean) => void): void;
  18. }
  19. export interface ReadJsonAsyncCallback {
  20. (err?: Error, content?: any): void;
  21. }
  22. export interface ReadJsonAsync {
  23. (path: string, callback: ReadJsonAsyncCallback): void;
  24. }
  25. export declare function fileExistsSync(path: string): boolean;
  26. /**
  27. * Reads package.json from disk
  28. * @param file Path to package.json
  29. */
  30. export declare function readJsonFromDiskSync(packageJsonPath: string): any | undefined;
  31. export declare function readJsonFromDiskAsync(path: string, callback: (err?: Error, content?: any) => void): void;
  32. export declare function fileExistsAsync(path2: string, callback2: (err?: Error, exists?: boolean) => void): void;
  33. export declare function removeExtension(path: string): string;