pretty-json-file-formatter

1.1.1 • Public • Published

pretty-json-file-formatter

A Node.js library for formatting JSON files in a pretty and human-readable way.

Installation

You can install the library via npm:

npm install pretty-json-file-formatter

Usage

const formatJsonFile = require('pretty-json-file-formatter');

// Format a JSON file
formatJsonFile('/path/to/your/file.json')
  .then(() => {
    console.log('JSON file formatted successfully.');
  })
  .catch((err) => {
    console.error('An error occurred:', err);
  });

API

formatJsonFile(filePath)

Formats the JSON data in the specified file and writes the formatted data back to the same file.

  • filePath (string): The path to the JSON file.

Returns a Promise that resolves when formatting is done.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Package Sidebar

Install

npm i pretty-json-file-formatter

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

3.36 kB

Total Files

5

Last publish

Collaborators

  • mincy76