Share your code. Components are building blocks, you are the architect.

global/write-json-file
v0.0.7
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
In json
MIT
PUBLIC
66
1     DEPENDENCIES
Build: pass
BuildPass
Build Status: pass

Write json to file - (string or object)

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use global/write-json-file in your project
npm i @bit/amit.json.global.write-json-file
Copied

writeJsonFile (file:string, data)

Write json to file - (string or object)

Example

```js
const writeJsonFile = require('bit/global/write-json-file');
const jsonFile = "/tmp/exampleFile.json";
writeJsonFile(jsonFile,{isThisReal:ture,author:amit}).catch(err => console.log(err));
```

Arguments

file: string

path to file(path must exist)

data

json string or Object to write

Returns

promise(jsonString)

Test Summary


writeJsonFile write json object to filePass
writeJsonFile write json string to filePass
writeJsonFile validate written filePass
writeJsonFile when sending broken json should get exceptionPass