Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

create-file

1.0.1 • Public • Published

create-file

NPM version js-xo-style

Write to a file only if it does not exist

Installation

Install create-file using npm:

npm install --save create-file

Usage

Module usage

var createFile = require('create-file');
 
createFile('/path/to/file/to-create', 'my content\n', function (err) {
  // file either already exists or is now created (including non existing directories)
});

API

createFile(filename, contents, cb)

Name Type Description
filename String The filename to create
contents String The content to write
cb Function Callback

License

MIT

Install

npm i create-file

DownloadsWeekly Downloads

3,065

Version

1.0.1

License

MIT

Last publish

Collaborators

  • avatar