Socket
Socket
Sign inDemoInstall

write-json5-file

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

write-json5-file

Stringify and write JSON to a file atomically


Version published
Weekly downloads
1.4K
decreased by-9.16%
Maintainers
1
Weekly downloads
 
Created
Source

write-json5-file

Stringify and write JSON to a file atomically

npm version

Installation

<npm|yarn|pnpm> add write-json5-file

Usage

const writeJson5File = require('write-json5-file')

writeJson5File('foo.json5', {foo: true}).then(() => {
	console.log('done')
})

API

writeJson5File(filepath, data, [options])

Returns a promise.

writeJson5File.sync(filepath, data, [options])

options
indent

Type: string, number Default: \t

Indentation as a string or number of spaces. Pass in null for no formatting.

sortKeys

Type: boolean, function Default: false

Sort the keys recursively. Optionally pass in a compare function.

replacer

Type: function

Passed into JSON.stringify.

mode

Type: number Default 438 (0666 in octal)

Mode used when writing the file.

License

MIT © Zoltan Kochan

Keywords

FAQs

Package last updated on 25 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc