You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
381 B
20 lines
381 B
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); |
|
}
|
|
|