How to use the fs-promise.writeFile function in fs-promise

To help you get started, we’ve selected a few fs-promise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heineiuo / seashell / src / cli.js View on Github external
function createService(program, callback){
  console.log('Creating auth file...')
  var service = {}
  var targetPath = program.targetPath || process.cwd()
  service.appId = uuid.v4()
  service.appName = program.appName || 'unnamed'
  service.appSecret = createSecret()

  var data = JSON.stringify(service, null, 2)

  fs.writeFile(targetPath+'/'+service.appId+'.json', data, 'UTF-8', function (err) {
    if (err) console.error(err)
    console.log('Create auth file in path '+targetPath)
  })

}
github heineiuo / seashell / packages / seashell-cli / cli.js View on Github external
function createService(program, callback){
  console.log('Creating auth file...')
  var service = {}
  var targetPath = program.targetPath || process.cwd()
  service.appId = uuid.v4()
  service.appName = program.appName || 'unnamed'
  service.appSecret = createSecret()

  var data = JSON.stringify(service, null, 2)

  fs.writeFile(targetPath+'/'+service.appId+'.json', data, 'UTF-8', function (err) {
    if (err) console.error(err)
    console.log('Create auth file in path '+targetPath)
  })

}
github mozilla-jetpack / jpm / lib / init.js View on Github external
}, function(err, ok) {
        if (!ok || ok.toLowerCase().charAt(0) !== "y") {
          return reject("Aborted.");
        } else {
          fs.writeFile(packagePath, data, "utf-8").then(resolve, reject);
        }
      });
    });
github mariusGundersen / Samsara / mutators / spiritConfig.js View on Github external
module.exports = co.wrap(function*(name, mutate){
  const path = 'config/spirits/'+name+'/config.json';
  
  const json = yield fs.readFile(path);
  const config = JSON.parse(json);
  const mutatedConfig = yield (mutate(config) || config);
  const contents = JSON.stringify(mutatedConfig, null, '  ');
  
  return fs.writeFile(path, contents);
});
github twosigma / git-meta / node / lib / util / sequencer_state_util.js View on Github external
const writeCommitAndRef = co.wrap(function *(dir, name, commitAndRef) {
    const filePath = path.join(dir, name);
    let content = commitAndRef.sha + "\n";
    if (null !== commitAndRef.ref) {
        content += commitAndRef.ref + "\n";
    }
    yield fs.writeFile(filePath, content);
});

fs-promise

[DEPRECATED] Use mz or fs-extra^3.0 with Promise Support

MIT
Latest version published 8 years ago

Package Health Score

53 / 100
Full package analysis