Write to a file only if it does not exist
Install create-file using npm:
npm install --save create-filevar 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)
});| Name | Type | Description |
|---|---|---|
| filename | String |
The filename to create |
| contents | String |
The content to write |
| cb | Function |
Callback |
MIT