write-json-safe
Write formatted JSON to a file
Last updated 5 years ago by bconnorwhite .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install write-json-safe 
SYNC missed versions from official npm registry.

write-json-safe

NPM TypeScript Coverage Status GitHub Stars Twitter Follow

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;
}

Dependenciesdependencies


Dev DependenciesDavid


License license

MIT


Related Packages

Current Tags

  • 2.1.0                                ...           latest (5 years ago)

6 Versions

  • 2.1.0                                ...           5 years ago
  • 2.0.2                                ...           5 years ago
  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 1
Last Month 1
Dependencies (2)
Dev Dependencies (4)

Copyright 2013 - present © cnpmjs.org | Home |