create-file

Write to a file only if it does not exist

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
create-file
411.0.18 years ago8 years agoMinified + gzip package size for create-file in KB

Readme

create-file
!NPM versionnpm-imagenpm-url !js-xo-stylecodestyle-imagecodestyle-url
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