Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork40
Stringify and write JSON to a file atomically
License
sindresorhus/write-json-file
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Stringify and write JSON to a fileatomically
Creates directories for you as needed.
npm install write-json-file
import{writeJsonFile}from'write-json-file';awaitwriteJsonFile('foo.json',{foo:true});
Returns aPromise
.
Type:object
Type:string | number | undefined
Default:'\t'
Indentation as a string or number of spaces.
Pass inundefined
for no formatting.
If you set both this anddetectIndent
, this value will be used when the indentation cannot be detected.
Type:boolean
Default:false
Detect indentation automatically if the file exists.
Type:boolean | Function
Default:false
Sort the keys recursively.
Optionally pass in acompare
function.
Type:Function
Passed intoJSON.stringify
.
Type:number
Default:0o666
Themode used when writing the file.
- load-json-file - Read and parse a JSON file
- make-dir - Make a directory and its parents if needed
About
Stringify and write JSON to a file atomically
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors10
Uh oh!
There was an error while loading.Please reload this page.