lib/util/file.js
function (file, content, charset, callback) {
    try {
        if (!file) {
            return;
        }
        charset = (charset || 'utf-8').toLowerCase();
        if (charset !== 'utf-8') {
            content = require('iconv-lite').encode(content + '\r\n', charset);
        }
        callback.call(this, file, content);
    } catch (ex) {
        throw util.format('cant write file [%s]%s for %s', charset, file, ex);
    }
}
function (file, content, charset, callback) {
    try {
        if (!file) {
            return;
        }
        charset = (charset || 'utf-8').toLowerCase();
        if (charset !== 'utf-8') {
            content = require('iconv-lite').encode(content + '\r\n', charset);
        }
        callback.call(this, file, content);
    } catch (ex) {
        throw util.format('cant write file [%s]%s for %s', charset, file, ex);
    }
}
function ( file , content , charset , callback ) { try { if ( ! file ) { return ; } charset = ( charset || 'utf-8' ) . toLowerCase ( ) ; if ( charset !== 'utf-8' ) { content = require ( 'iconv-lite' ) . encode ( content + '\r\n' , charset ) ; } callback . call ( this , file , content ) ; } catch ( ex ) { throw util . format ( 'cant write file [%s]%s for %s' , charset , file , ex ) ; } }
write content to file
@param  {string} file    - absolute file path
@param  {string} content - file content
@param  {string} charset - content charset, default is utf-8
@return {undefined}
write content to file