Socket
Socket
Sign inDemoInstall

write-json-file

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

write-json-file - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

6

index.js

@@ -6,3 +6,3 @@ 'use strict';

const sortKeys = require('sort-keys');
const mkdirp = require('mkdirp');
const makeDir = require('make-dir');
const pify = require('pify');

@@ -37,8 +37,8 @@

module.exports = (fp, data, opts) =>
pify(mkdirp)(path.dirname(fp), {fs})
makeDir(path.dirname(fp), {fs})
.then(() => main(pify(writeFileAtomic), fp, data, opts));
module.exports.sync = (fp, data, opts) => {
mkdirp.sync(path.dirname(fp), {fs});
makeDir.sync(path.dirname(fp), {fs});
main(writeFileAtomic.sync, fp, data, opts);
};
{
"name": "write-json-file",
"version": "2.0.0",
"version": "2.1.0",
"description": "Stringify and write JSON to a file atomically",

@@ -37,15 +37,12 @@ "license": "MIT",

"graceful-fs": "^4.1.2",
"mkdirp": "^0.5.1",
"make-dir": "^1.0.0",
"pify": "^2.0.0",
"sort-keys": "^1.1.1",
"write-file-atomic": "^1.1.2"
"write-file-atomic": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"tempfile": "^1.1.1",
"tempfile": "^2.0.0",
"xo": "*"
},
"xo": {
"esnext": true
}
}
# write-json-file [![Build Status](https://travis-ci.org/sindresorhus/write-json-file.svg?branch=master)](https://travis-ci.org/sindresorhus/write-json-file)
> Stringify and write JSON to a file [atomically](https://github.com/iarna/write-file-atomic)
> Stringify and write JSON to a file [atomically](https://github.com/npm/write-file-atomic)

@@ -30,3 +30,3 @@ Creates directories for you as needed.

Returns a promise.
Returns a `Promise`.

@@ -37,8 +37,10 @@ ### writeJsonFile.sync(filepath, data, [options])

Type: `Object`
##### indent
Type: `string`, `number`
Type: `string` `number`<br>
Default: `\t`
Indentation as a string or number of spaces.
Indentation as a string or number of spaces.<br>
Pass in `null` for no formatting.

@@ -48,6 +50,6 @@

Type: `boolean`, `function`
Type: `boolean` `function`<br>
Default: `false`
Sort the keys recursively.
Sort the keys recursively.<br>
Optionally pass in a [`compare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) function.

@@ -63,4 +65,4 @@

Type: `number`
Default `438` *(0666 in octal)*
Type: `number`<br>
Default: `0o666`

@@ -73,2 +75,3 @@ [Mode](https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation) used when writing the file.

- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file
- [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed

@@ -78,2 +81,2 @@

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
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