json-fn-file
v1.0.0
Published
Apply a function to a json file and save to a file
Downloads
3
Readme
json-fn-file
Apply a function to a json file and save to a file
Install
npm install --save json-fn-file
Usage
const jsonFnFile = require('json-fn-file');
// Assuming "input.json" contains:
// {
// "key1": "Value1",
// "key2": "Value2"
// }
jsonFnFile('input.json', 'output.txt', input => Object.keys(input));
//=> 'key1,key2'
API
jsonFnFile(inputFile, outputFile, fn)
Arguments
| Name | Description | Type | Default |
| ------- | ------------------------------- | -------- | ------- |
| inputFile | File path to input json file | string
| None (required) |
| outputFile | File path to output file | string
| None (required) |
| fn | Converter function to run on json | function
| (in) => (in) |
Your function will be fed one argument, the json content of inputFile
.
Returns
Type: object
License
MIT © Dawson Botsford