@ac-essentials/misc-util
    Preparing search index...

    Function writeJsonFile

    • Writes a JSON file by stringifying the provided data.

      Parameters

      • path: FileHandle | PathLike

        Path to the JSON file.

      • data: unknown

        Data to be stringified and written to the file.

      • Optionaloptions: {
            charsetEncoding?: string;
            endOfLine?: null | "\n" | "\r\n";
            finalNewline?: null | boolean;
            flag?: OpenMode;
            flush?: boolean;
            indentation?: string;
            mode?: Mode;
            replacer?: JsonReplacer;
            signal?: null | AbortSignal;
            trimTrailingWhitespace?: null | boolean;
        }

        Options for writing the file and stringifying JSON.

        • OptionalcharsetEncoding?: string

          The character set encoding of the file.

          Defaults to "utf-8".

        • OptionalendOfLine?: null | "\n" | "\r\n"

          The line ending style of the file.

          If null, the stringifier default is used.

          Defaults to null.

        • OptionalfinalNewline?: null | boolean

          Whether the file should end with a newline.

          If null, the stringifier default is used.

          Defaults to null.

        • Optionalflag?: OpenMode
        • Optionalflush?: boolean

          If all data is successfully written to the file, and flush is true, filehandle.sync() is used to flush the data.

          false
          
        • Optionalindentation?: string

          The indentation string of the JSON file.

          Defaults to an empty string (no indentation).

        • Optionalmode?: Mode
        • Optionalreplacer?: JsonReplacer

          A function that alters the behavior of the stringification process.

          See MDN for more information.

        • Optionalsignal?: null | AbortSignal

          When provided the corresponding AbortController can be used to cancel an asynchronous action.

        • OptionaltrimTrailingWhitespace?: null | boolean

          Whether to trim trailing whitespace when writing the file.

          If null, the stringifier default is used.

          Defaults to null.

      Returns Promise<void>

      A promise that resolves when the file has been written.