function fetch(filename, options, callback) {
        if (typeof options === "function") {
          callback = options;
          options = {};
        } else if (!options) options = {};

        if (!callback) return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this

        // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
        if (!options.xhr && fs && fs.readFile)
          return fs.readFile(
            filename,
            function fetchReadFileCallback(err, contents) {
              return err && typeof XMLHttpRequest !== "undefined"
                ? fetch.xhr(filename, options, callback)
                : err
                ? callback(err)
                : callback(
                    null,
                    options.binary ? contents : contents.toString("utf8")
                  );
            }
          );

        // use the XHR version otherwise.
        return fetch.xhr(filename, options, callback);
      }
/**
       * Fetches the contents of a file.
       * @memberof util
       * @param {string} filename File path or url
       * @param {FetchOptions} options Fetch options
       * @param {FetchCallback} callback Callback function
       * @returns {undefined}
       */
Fetches the contents of a file.
Fetches the contents of a file .
function fetch(filename, options, callback) {
        if (typeof options === "function") {
          callback = options;
          options = {};
        } else if (!options) options = {};
        if (!callback) return asPromise(fetch, this, filename, options); 
        if (!options.xhr && fs && fs.readFile)
          return fs.readFile(
            filename,
            function fetchReadFileCallback(err, contents) {
              return err && typeof XMLHttpRequest !== "undefined"
                ? fetch.xhr(filename, options, callback)
                : err
                ? callback(err)
                : callback(
                    null,
                    options.binary ? contents : contents.toString("utf8")
                  );
            }
          );
        return fetch.xhr(filename, options, callback);
      }
function fetch ( filename , options , callback ) { if ( typeof options === "function" ) { callback = options ; options = { } ; } else if ( ! options ) options = { } ; if ( ! callback ) return asPromise ( fetch , this , filename , options ) ; if ( ! options . xhr && fs && fs . readFile ) return fs . readFile ( filename , function fetchReadFileCallback ( err , contents ) { return err && typeof XMLHttpRequest !== "undefined" ? fetch . xhr ( filename , options , callback ) : err ? callback ( err ) : callback ( null , options . binary ? contents : contents . toString ( "utf8" ) ) ; } ) ; return fetch . xhr ( filename , options , callback ) ; }
Fetches the contents of a file.
Fetches the contents of a file .
// eslint-disable-line no-invalid-this // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found. // use the XHR version otherwise.