mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-07 04:31:21 -06:00
21 lines
381 B
JavaScript
21 lines
381 B
JavaScript
var fs = require('fs');
|
|
|
|
/**
|
|
* Expose `write`.
|
|
*/
|
|
|
|
module.exports = write;
|
|
|
|
/**
|
|
* Write `contents` to a `file`, falling back to stdout.
|
|
*
|
|
* @param {String} file
|
|
* @param {String} contents
|
|
*/
|
|
|
|
function write (file, contents) {
|
|
if (1 == arguments.length) contents = file, file = null;
|
|
if (file) return fs.writeFileSync(file, contents);
|
|
process.stdout.write(contents);
|
|
}
|