json-file-output.d.ts 1.1 KB

12345678910111213141516
  1. export declare const MIN_VERSION_FOR_MKDIR_RECURSIVE = "10.12.0";
  2. /**
  3. * Attempts to create a directory and fails quietly if it cannot. Rather than throwing errors it logs them to stderr and returns false.
  4. * It will attempt to recursively nested direcotry (ex `mkdir -p` style) if it needs to but will fail to do so with Node < 10 LTS.
  5. * @param newDirectoryFullPath the full path to a directory to create
  6. * @returns true if either the directory already exists or it is successful in creating one or false if it fails to create it.
  7. */
  8. export declare function createDirectory(newDirectoryFullPath: string): boolean;
  9. /**
  10. * Write the given contents to a file.
  11. * If any errors are thrown in the process they are caught, logged, and discarded.
  12. * @param jsonOutputFile the path of the file you want to write.
  13. * @param contents the contents you want to write.
  14. */
  15. export declare function writeContentsToFileSwallowingErrors(jsonOutputFile: string, contents: string): Promise<void>;
  16. export declare function saveJsonToFileCreatingDirectoryIfRequired(jsonOutputFile: string, contents: string): Promise<void>;