Sha256: 235296861c48986aeb900c0861ac84f23743a5f20b73e0315a7b5243b05cee37

Contents?: true

Size: 683 Bytes

Versions: 20

Compression:

Stored size: 683 Bytes

Contents

var fs = require('graceful-fs')
var path = require('path')
var jsonFile = require('jsonfile')
var mkdir = require('./mkdir')

function outputJsonSync(file, data) {
  var dir = path.dirname(file)

  if (!fs.existsSync(dir))
    mkdir.mkdirsSync(dir)

  jsonFile.writeFileSync(file, data)
}

function outputJson(file, data, callback) {
  var dir = path.dirname(file)

  fs.exists(dir, function(itDoes) {
    if (itDoes) return jsonFile.writeFile(file, data, callback)

    mkdir.mkdirs(dir, function(err) {
      if (err) return callback(err)
      jsonFile.writeFile(file, data, callback)
    })
  })
}

module.exports = {
  outputJsonSync: outputJsonSync,
  outputJson: outputJson
}

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
hooch-0.4.1 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
hooch-0.4.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
gulp_assets-1.0.0.pre.5 template/node_modules/css-mqpacker/node_modules/fs-extra/lib/json.js
gulp_assets-1.0.0.pre.4 template/node_modules/css-mqpacker/node_modules/fs-extra/lib/json.js
gulp_assets-1.0.0.pre.3 template/node_modules/css-mqpacker/node_modules/fs-extra/lib/json.js
hooch-0.3.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
hooch-0.2.1 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
hooch-0.2.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
hooch-0.1.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
hooch-0.0.8 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
hooch-0.0.7 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
hooch-0.0.6 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
entangled-0.0.16 spec/dummy/public/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
entangled-0.0.15 spec/dummy/public/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
entangled-0.0.14 spec/dummy/public/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
entangled-0.0.13 spec/dummy/public/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
entangled-0.0.12 spec/dummy/public/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
entangled-0.0.11 spec/dummy/public/node_modules/phantomjs/node_modules/fs-extra/lib/json.js
entangled-0.0.10 spec/dummy/public/node_modules/phantomjs/node_modules/fs-extra/lib/json.js