Fire any awaiting callbacks for given file data.

@private
@param {string} filename           The filename to fire callbacks on.
@param {Buffer|Error} data         The received data.
@param {boolean} [error=false]     Is this an error or file data?
519403
function _fireReadFileCallbacks(filename, data, error=false) {
  const callbacks = readFileCallbacks.get(filename);
  if (callbacks) {
    if (callbacks.size) callbacks.forEach(callback=>error?callback(data, null):callback(null, data));
    callbacks.clear();
    readFileCallbacks.delete(filename);
  }
}
590120
function (data, callback) {
    if (typeof callback !== 'function') {
        this.debug("Registering dummy callback, because a response message is expected");
    } else {
        this.debug("Registering callback");
    }
    this.waitingCallbacks.push(callback);
    send.call(this, data);
}
38493
function onError (fn) {
  callbacks.push(fn);
  if (window.onerror != handler) {
    callbacks.push(window.onerror);
    window.onerror = handler;
  }
}
1059797
function insertCallback(error, data) {
  console.log(require('util').inspect(error ? error.message : data, { showHidden: true, colors: true, depth: 2 }));
}
951106
function (file) {
      return $.Deferred(function (deferred) {
        $.extend(new FileReader(), {
          onload: function (e) {
            var dataURL = e.target.result;
            deferred.resolve(dataURL);
          },
          onerror: function () {
            deferred.reject(this);
          }
        }).readAsDataURL(file);
      }).promise();
    }
451390
function watchFile(files, callback) {
  [].concat(files).forEach((file) => {
    watchr.open(file, (changeType) => {
      if (changeType === 'update') {
        callback(file);
      }
    }, (err) => {
      if (err && err.code !== 'ENOENT') {
        throw err;
      }
    });
  });
}
678024
function handleEvent(cmd, context, filename, callback) {
  var event = JSON.parse(cmd)
  eventline.route(event)
}
1098700
function(id, callback) {
        /**
         * Callback for QB.content.delete(id, callback)
         * @callback deleteFileCallback
         * @param {object} error - The error object
         * @param {object} response - Boolean
         */
        this.service.ajax({url: Utils.getUrl(config.urls.blobs, id), type: 'DELETE', dataType: 'text'}, function(err, result) {
            if (err) {
                callback(err, null);
            } else {
                callback(null, true);
            }
        });
    }
265814
function File(data, callback) {
    stream.Duplex.call(this);

    this._header = new Header();
    this._tracks = [];

    if (data && buffer.Buffer.isBuffer(data)) {
        this.setData(data, callback || noop);
    }
}
7663
function callback (prefix, name, message) {
      if (!message) {
        return false;
      }
      count++;
      var msg  = errMsg(prefix, name, message);
      switch(action) {
      case 'show':
        console.log(msg);
        break;
      case 'hide':
        break;
      case 'throw':
      case 'copy':
        throw new Error(msg);
      }
      return true;
    }
424126
function onDelete( error ) {
			if ( error ) {
				debug( 'Error encountered while attempting to delete a temporary output file %s: %s', outFile, error.message );
				return done( error );
			}
			debug( 'Successfully deleted temporary output file: %s', outFile );
			done( null, file );
		}
1075468
function (r) {
            // If DONE (cancelled), then don't do anything
            if (me._readyState === FileReader.DONE) {
                return;
            }

            // DONE state
            me._readyState = FileReader.DONE;

            if (r instanceof Array) {
                r = new Uint8Array(r).buffer;
            }
            me._result = r;

            // If onload callback
            if (typeof me.onload === 'function') {
                me.onload(new ProgressEvent('load', { target:me }));
            }

            // If onloadend callback
            if (typeof me.onloadend === 'function') {
                me.onloadend(new ProgressEvent('loadend', { target:me }));
            }
        }
713918
function(r) {
            // If DONE (cancelled), then don't do anything
            if (me._readyState === FileReader.DONE) {
                return;
            }

            // Save result
            me._result = r;

            // If onload callback
            if (typeof me.onload === "function") {
                me.onload(new ProgressEvent("load", {target:me}));
            }

            // DONE state
            me._readyState = FileReader.DONE;

            // If onloadend callback
            if (typeof me.onloadend === "function") {
                me.onloadend(new ProgressEvent("loadend", {target:me}));
            }
        }
749649
function onFile( error, file ) {
		if ( error ) {
			debug( 'Error encountered while attempting to read a temporary output file %s: %s', outFile, error.message );
			return done( error );
		}
		debug( 'Successfully read temporary output file: %s', outFile );
		unlink( outFile, onDelete );

		/**
		* FUNCTION: onDelete( [error] )
		*	Callback invoked upon deleting a file.
		*
		* @private
		* @param {Error} [error] - error object
		* @returns {Void}
		*/
		function onDelete( error ) {
			if ( error ) {
				debug( 'Error encountered while attempting to delete a temporary output file %s: %s', outFile, error.message );
				return done( error );
			}
			debug( 'Successfully deleted temporary output file: %s', outFile );
			done( null, file );
		} // end FUNCTION onDelete()
	}
1233585
function processFile(file, filename, callback) {
      // Check if it matches the convention.
      if (path.extname(filename) === '.metadata') {
        // Find the name of the metadata.
        const name = path.basename(filename, '.metadata')

        // Recursively merge the meta data.
        const newMetadata = {}
        newMetadata[name] = file
        extend(true, metadata, newMetadata)

        // Remove the file since we've now processed it.
        delete files[filename]
      }

      callback()
    }
777275
function() {
      FS.readFile(path, options.encoding, function(err, text) {
        if (err) {
          // Forward the error
          return callback(err);
        }
        // Success
        callback(null, text.toString());
      });
    }
1122032
function onData(data) {

		data = data.toString("ascii");
		bufferedData += data;

		if (debug) console.log("Server: " + util.inspect(data));

		if (checkResp === true) {

			if (bufferedData.substr(0, 3) === "+OK") {

				checkResp = false;
				response = true;

			} else if (bufferedData.substr(0, 4) === "-ERR") {

				checkResp = false;
				response = false;

			// The following is only used for SASL
			} else if (multiline === false) {

				checkResp = false;
				response = true;

			}
		}

		if (checkResp === false) {

			if (multiline === true && (response === false || bufferedData.substr(bufferedData.length-5) === "\r\n.\r\n")) {

				// Make a copy to avoid race conditions
				var responseCopy = response;
				var bufferedDataCopy = bufferedData;

				response = null;
				checkResp = true;
				multiline = false;
				bufferedData = "";

				callback(responseCopy, bufferedDataCopy);

			} else if (multiline === false) {

				// Make a copy to avoid race conditions
				var responseCopy = response;
				var bufferedDataCopy = bufferedData;

				response = null;
				checkResp = true;
				multiline = false;
				bufferedData = "";

				callback(responseCopy, bufferedDataCopy);

			}
		} 
	}