README
Write formatted JSON to a file.
Installation
yarn add write-json-safe
npm install write-json-safe
API
import { writeJSON, writeJSONSync, Options, JSONObject } from "write-json-safe";
function writeJSON(path: string, content?: JSONObject, options?: Options): Promise<boolean>;
function writeJSONSync(path: string, content?: JSONObject, options?: Options): boolean;
type Options = {
/**
* Output formatted JSON. Default: `true`
*/
pretty?: boolean;
/**
* Recursively create parent directories if needed. Default: `true`
*/
recursive?: boolean;
/**
* Ensure file ends with a newline. Default: `true`
*/
appendNewline?: boolean;
/**
* Write even if file already exists. Default: `true`
*/
overwrite?: boolean;
}
Dependencies
- stringify-json-object: Stringify and format a JSON object
- write-file-safe: Write files, and create parent directories if necessary
Dev Dependencies
- @bconnorwhite/bob: Bob is a toolkit for TypeScript projects
License 
Related Packages
- fs-safe: A simple fs wrapper that doesn't throw
- read-json-safe: Read JSON files without try catch
- write-file-safe: Write files, and create parent directories if necessary
- write-md-safe: Write markdown files from a Marked token list or string