Load a _file_'s contents.

@param  {string} file
@param  {function} callback
@return {string}
@api public
435516
function(file, callback) {
      if (any(hook('loading', file), haveStopped)) return
      if ('readFile' in main)
        return readFile(file)
      else if (this.hasXhr()) {
        var request = this.xhr()
        request.open('GET', file, false)
        request.send(null)
        if (request.readyState == 4 && 
           (request.status == 0 || 
            request.status.toString().charAt(0) == 2)) 
          return request.responseText
      }
      else
        error("failed to load `" + file + "'")
    }
953557
function (file) {
    return new File({
      pattern: this.pattern,
      recurse: this.recurse,
      dirname: file.dirname,
      segment: file.segment,
      path: file.path
    });
  }
1042767
function _readJSONFile (file, callback) {

			if ("undefined" === typeof file) {
				throw new ReferenceError("missing \"file\" argument");
			}
				else if ("string" !== typeof file) {
					throw new TypeError("\"file\" argument is not a string");
				}
				else if ("" === file.trim()) {
					throw new Error("\"file\" argument is empty");
				}
			else if ("undefined" === typeof callback) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				isFileProm(file).then((exists) => {

					return !exists ?
						Promise.reject(new Error("The file does not exist")) :
						new Promise((resolve, reject) => {

							readFile(file, (err, content) => {
								return err ? reject(err) : resolve(content);
							});

						});

				}).then((content) => {
					callback(null, JSON.parse(content));
				}).catch(callback);

			}

		}
963114
function handleFile(name, file, options, cache, callback) {
	var cachedData;
	if(!options || !options.settings || options.settings['view cache'] !== false) {
		cachedData = cache && cache.get(file);
	}
	if (!cachedData) {
		loadFile(file, function(err, fileData) {
			if (err) {
				return callback(err);
			}

			var partials;
			try {
				partials = findPartials(fileData);
			} catch (err) {
				return callback(err);
			}

			var data = {
				name: name,
				data: fileData,
				partials: partials
			};
			if (cache) {
				cache.set(file, data);
			}
			return callback(null, data);
		});
	}
	else {
		return callback(null, cachedData);
	}
}
112992
function (callback) {
            async.map([ "tid.dat.gz", "tid_pos.dat.gz", "tid_map.dat.gz" ], function (filename, _callback) {
                loadArrayBuffer(path.join(dic_path, filename), function (err, buffer) {
                    if(err) {
                        return _callback(err);
                    }
                    _callback(null, buffer);
                });
            }, function (err, buffers) {
                if(err) {
                    return callback(err);
                }
                var token_info_buffer = new Uint8Array(buffers[0]);
                var pos_buffer = new Uint8Array(buffers[1]);
                var target_map_buffer = new Uint8Array(buffers[2]);

                dic.loadTokenInfoDictionaries(token_info_buffer, pos_buffer, target_map_buffer);
                callback(null);
            });
        }
403736
function loadImage (file, callback, options) {
    var img = document.createElement('img')
    var url
    img.onerror = function (event) {
      return loadImage.onerror(img, event, file, callback, options)
    }
    img.onload = function (event) {
      return loadImage.onload(img, event, file, callback, options)
    }
    if (typeof file === 'string') {
      loadImage.fetchBlob(
        file,
        function (blob) {
          if (blob) {
            file = blob
            url = loadImage.createObjectURL(file)
          } else {
            url = file
            if (options && options.crossOrigin) {
              img.crossOrigin = options.crossOrigin
            }
          }
          img.src = url
        },
        options
      )
      return img
    } else if (
      loadImage.isInstanceOf('Blob', file) ||
      // Files are also Blob instances, but some browsers
      // (Firefox 3.6) support the File API but not Blobs:
      loadImage.isInstanceOf('File', file)
    ) {
      url = img._objectURL = loadImage.createObjectURL(file)
      if (url) {
        img.src = url
        return img
      }
      return loadImage.readFile(file, function (e) {
        var target = e.target
        if (target && target.result) {
          img.src = target.result
        } else if (callback) {
          callback(e)
        }
      })
    }
  }
211578
function loadBinary (file, callback) {
  if (isPlask) {
    loadBinaryPlask(file, callback)
  } else {
    loadBinaryBrowser(file, callback)
  }
}
1123544
function(file, callback) {
        var number = arguments[2] || 0;
        var location = url.parse(file);
        var protocol = location.protocol === 'http:' ? http : https;
        var timeoutEventId;
        var that = this;
        var REDIRECTION_MAX = 3;

        var done = function(errors, data) {
            clearTimeout(timeoutEventId);
            callback(errors, data);
        }


        var request = protocol.request({
                method: 'GET',
                host: location.host,
                hostname: location.hostname,
                path: location.path,
                port: location.port,
                headers: this.adapter.resourceRequestHeaders(file)
            }, function(res) {

                var encoding = res.headers['content-encoding'];
                var type = res.headers['content-type'];
                var statusCode = res.statusCode;
                var errors = null;

                if (/3\d\d/.test(statusCode) && res.headers.location && number < REDIRECTION_MAX) {
                    clearTimeout(timeoutEventId);
                    var file = res.headers.location;
                    number++;
                    that.loadRemoteFile(file, callback, number);
                    return;
                } else if (!/2\d\d/.test(statusCode)) {
                    errors = new Error(res.statusMessage);
                }

                if (type.indexOf('text/') !== 0) {
                    errors = new Error('only supports `text/*` resources');
                }


                if (errors) {
                    done(errors);
                } else {

                    var buffer = new Buffer([]);


                    if (encoding === 'undefined') {
                        res.setEncoding('utf-8');
                    }


                    res.on('data', function(chunk) {
                        buffer = Buffer.concat([buffer, chunk]);
                    });

                    res.on('end', function() {

                        if (encoding === 'gzip') {

                            zlib.unzip(buffer, function(errors, buffer) {
                                if (errors) {
                                    done(errors);
                                } else {
                                    done(null, buffer);
                                }
                            });

                        } else if (encoding == 'deflate') {

                            zlib.inflate(buffer, function(errors, decoded) {
                                if (errors) {
                                    done(errors);
                                } else {
                                    done(null, decoded);
                                }
                            });

                        } else {
                            done(null, buffer);
                        }

                    });

                }

            })
            .on('error', done)
            .on('timeout', function(errors) {
                request.abort();
                done(errors);
            });


        timeoutEventId = setTimeout(function() {
            request.emit('timeout', new Error('have been timeout'));
        }, this.adapter.resourceTimeout);


        request.end();

    }
897887
function(callback){
    var argFiles,
        filePath,
        i;

    if(!program.files || program.files.length === 0){
        return callback(null, true);
    }

    argFiles = program.files.split(',');

    output("Loading files...");

    for(i=0; i<argFiles.length; i++){
        filePath = path.resolve(__dirname, argFiles[i].toString());
        output("Reading file..." + filePath);
        if(fs.existsSync(filePath)){
            files.push(fs.readFileSync(filePath));
        }else{
            return callback("File does not exist, " + filePath, false);
        }
    }

    callback(null, true);
}
510533
function loadFile(fullFilePath, callback) {
	fs.readFile(fullFilePath, "utf-8", function(err, data) {
		if (err) {
			return callback(err);
		}

		return callback(null, data);
	});
}
616917
function(file, callback) {
        if (isBrowser && file instanceof window.File) {
            // Browser File instance
            return this.addImageFromBuffer(file, callback);
        }

        // File on filesystem. Note: the reason why we need the size of the file
        // is because of reverse proxies like Varnish which doesn't handle chunked
        // Transfer-Encoding properly - instead we need to explicitly pass the
        // content length so it knows not to terminate the HTTP connection
        readers.getLengthOfFile(file, function(err, fileSize) {
            if (err) {
                return callback(err);
            }

            readers.createReadStream(file).pipe(request({
                method: 'POST',
                uri: this.getSignedResourceUrl('POST', this.getImagesUrl()),
                json: true,
                headers: {
                    'Accept': 'application/json',
                    'User-Agent': 'imboclient-js',
                    'Content-Length': fileSize
                },
                onComplete: function(addErr, res, body) {
                    callback(addErr, body ? body.imageIdentifier : null, body, res);
                }
            }));
        }.bind(this));

        return this;
    }
351922
function readFile(file) {

    if (file && fs.existsSync(file)) {
        return fs.readFileSync(file);
    }

    return null;
}
1262489
function loadFiles(paths, callbackFn, args) {
  // listify paths
  paths = paths.push ? paths : [paths];

  var numWaiting = paths.length,
      x = numWaiting,
      pathsNotFound = [],
      fn,
      i;

  // define callback function
  fn = function(path, result, defaultPrevented) {
    // handle error
    if (result == 'e') pathsNotFound.push(path);

    // handle beforeload event. If defaultPrevented then that means the load
    // will be blocked (ex. Ghostery/ABP on Safari)
    if (result == 'b') {
      if (defaultPrevented) pathsNotFound.push(path);
      else return;
    }

    numWaiting--;
    if (!numWaiting) callbackFn(pathsNotFound);
  };

  // load scripts
  for (i=0; i < x; i++) loadFile(paths[i], fn, args);
}
173429
function File(file, options) {
  Item.call(this, file, options);
  this.initFile(file);
  return file;
}
392304
function readFile (file) {
    if (!isFileRegistered(file)) { return undefined; }

    fileRegistry[file].content = gruntIsFile(file) ? gruntRead(file) + '\x0A' : '';
}
855920
function (lintFile, callback) {
  fs.readFile(lintFile, function (err, data) {
    if (err) {
      callback(err);
    } else {
      var parser = new xml2js.Parser({
        mergeAttrs: true
      });
      parser.parseString(data, function (err, result) {
        if (err) {
          callback(err);
        } else if (result && result.jslint) {
          callback(null, result.jslint.file);
        } else {
          callback('Invalid jslint xml file');
        }
      });
    }
  });
}
1197339
function(callback) {
            fs.exists(file, function(exists) {
                if(!exists) {
                    rawData = file;
                    if(typeof rawData === "string") rawData = new Buffer(file);
                    return callback();
                }

                fs.readFile(file, function(err, data) {
                    if(err) return callback(err);
                    rawData = data;
                    return callback();
                });
            });
        }