json-fs-query
    Preparing search index...

    Function formatDatabase

    • Rewrite every JSON file of the configured database (records, entries, indexes, __RECORDS.json) in one format: 'compact' or 'pretty' (see configure). Files already in that format are left alone, so running it twice changes nothing the second time. Writing in one format never stops the other from being read; this is for making a whole database match, for example after changing format on a database written before.

      Every file is read and checked before any is written: one that isn't valid JSON fails the whole call with its path, and nothing is changed (the public version runs as one statement, see withWriteSet). Node only.

      Parameters

      • format: "compact" | "pretty" = ...

        Defaults to the configured format.

      Returns Promise<formatResult>

      When format is neither 'compact' nor 'pretty', when a file isn't valid JSON, or in a browser.