pretty-json-file-formatter
v1.1.1
Published
A simple utility to format and beautify JSON files.
Downloads
5
Readme
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.