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

    Function writeJson5File

    • Writes a JSON5 file by stringifying the provided data.

      Parameters

      • path: FileHandle | PathLike

        Path to the JSON5 file.

      • data: unknown

        Data to be stringified and written to the file.

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

        Options for writing the file and stringifying JSON5.

        • OptionalcharsetEncoding?: string

          The character set encoding of the file.

          Defaults to "utf-8".

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

          The line ending style of the file.

          If null, the stringifier default is used.

          Defaults to null.

        • OptionalfinalNewline?: boolean | null

          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
        • OptionalquoteStyle?: "'" | "\""

          The quote style to use when writing the JSON5 file.

          Defaults to double quotes (").

        • Optionalreplacer?: JsonReplacer

          A function that alters the behavior of the stringification process.

          See MDN for more information.

        • Optionalsignal?: AbortSignal | null

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

        • OptionaltrimTrailingWhitespace?: boolean | null

          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.