src/core/base/wnComponent.js
function (filePath)
		{
			if (typeof arguments[1]=='function')
				var cb = arguments[1];

			if (typeof arguments[2]=='function')
				var cb = arguments[2];

			var binary = typeof arguments[1]=='boolean' ? arguments[1] : false,
				realPath = this.instanceOf('wnModule')?this.modulePath+filePath:filePath,
				cmd = !cb ? 'readFileSync' : 'readFile';

			try {
				var _cb = cb ? function (err,file) {
					cb&&cb(!err ? ((binary===true) ? file : file.toString()) : false);
				} : null,
				file = fs[cmd](realPath,_cb);
			} catch (e)
			{
				if (_cb)
					cb&&cb(false);
				else
					return false;
			}
			return (file ? (binary===true) ? file : file.toString() : false);
		}
function (filePath)
		{
			if (typeof arguments[1]=='function')
				var cb = arguments[1];

			if (typeof arguments[2]=='function')
				var cb = arguments[2];

			var binary = typeof arguments[1]=='boolean' ? arguments[1] : false,
				realPath = this.instanceOf('wnModule')?this.modulePath+filePath:filePath,
				cmd = !cb ? 'readFileSync' : 'readFile';

			try {
				var _cb = cb ? function (err,file) {
					cb&&cb(!err ? ((binary===true) ? file : file.toString()) : false);
				} : null,
				file = fs[cmd](realPath,_cb);
			} catch (e)
			{
				if (_cb)
					cb&&cb(false);
				else
					return false;
			}
			return (file ? (binary===true) ? file : file.toString() : false);
		}
function ( filePath ) { if ( typeof arguments [ 1 ] == 'function' ) var cb = arguments [ 1 ] ; if ( typeof arguments [ 2 ] == 'function' ) var cb = arguments [ 2 ] ; var binary = typeof arguments [ 1 ] == 'boolean' ? arguments [ 1 ] : false , realPath = this . instanceOf ( 'wnModule' ) ? this . modulePath + filePath : filePath , cmd = ! cb ? 'readFileSync' : 'readFile' ; try { var _cb = cb ? function ( err , file ) { cb && cb ( ! err ? ( ( binary === true ) ? file : file . toString ( ) ) : false ) ; } : null , file = fs [ cmd ] ( realPath , _cb ) ; } catch ( e ) { if ( _cb ) cb && cb ( false ) ; else return false ; } return ( file ? ( binary === true ) ? file : file . toString ( ) : false ) ; }
Get a file.
The file's path is relative to the module's path.
@param string $filePath file's path
@param boolean $binary is it binary?
@param function $cb async callback function
@return boolean|string
Get a file . The file s path is relative to the module s path .