Package Exports
- write-json-safe
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (write-json-safe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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;
}
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
- write-file-safe: Write files, and create parent directories if necessary