const write = require('write');
The following options may be used with any method.
Type: boolean
Default: undefined
Ensure that contents has a trailing newline before writing it to the file system.
write.sync('foo.txt', 'some data...', { newline: true });
Type: boolean
Default: undefined
Set to false
to prevent existing files from being overwritten. See increment for a less severe alternative.
write.sync('foo.txt', 'some data...', { overwrite: false });
Type: boolean
Default: undefined
Set to true
to automatically rename files by appending an increment, like foo (2).txt
, to prevent foo.txt
from being overwritten. This is useful when writing log files, or other information where the file name is less important than the contents being written.
write.sync('foo.txt', 'some data...', { increment: true });
// if "foo.txt" exists, the file will be renamed to "foo (2).txt"
{%= apidocs("index.js") %}
See [CHANGELOG.md].