function onReadFileRequested(options, onSuccess, onError) {
  var filePath = test_util.openedFiles[options.openRequestId];

  var continueRead = function() {
    if (options.fileSystemId !== test_util.FILE_SYSTEM_ID || !filePath) {
      onError('SECURITY');  // enum ProviderError.
      return;
    }

    if (filePath === '/' + TESTING_TIRAMISU_FILE.name) {
      var textToSend = TESTING_TEXT.substr(options.offset, options.length);
      var textToSendInChunks = textToSend.split(/(?= )/);

      textToSendInChunks.forEach(function(item, index) {
        // Convert item (string) to an ArrayBuffer.
        var reader = new FileReader();

        reader.onload = function(e) {
          onSuccess(
              e.target.result,
              index < textToSendInChunks.length - 1 /* hasMore */);
        };

        reader.readAsArrayBuffer(new Blob([item]));
      });
      return;
    }

    if (filePath === '/' + TESTING_VANILLA_FOR_ABORT_FILE.name) {
      // Do nothing. This simulates a very slow read.
      return;
    }

    if (filePath === '/' + TESTING_BROKEN_TIRAMISU_FILE.name) {
      onError('ACCESS_DENIED');  // enum ProviderError.
      return;
    }

    onError('INVALID_OPERATION');  // enum ProviderError.
  };

  if (readBreakpointCallback)
    readBreakpointCallback(filePath, continueRead);
  else
    continueRead();
}
/**
 * Requests reading contents of a file, previously opened with <code>
 * openRequestId</code>.
 *
 * @param {ReadFileRequestedOptions} options Options.
 * @param {function(ArrayBuffer, boolean)} onSuccess Success callback with a
 *     chunk of data, and information if more data will be provided later.
 * @param {function(string)} onError Error callback.
 */
Requests reading contents of a file, previously opened with
openRequestId.

@param {ReadFileRequestedOptions} options Options.
@param {function(ArrayBuffer, boolean)} onSuccess Success callback with a
chunk of data, and information if more data will be provided later.
@param {function(string)} onError Error callback.
Requests reading contents of a file previously opened with openRequestId . @param { ReadFileRequestedOptions } options Options . @param { function ( ArrayBuffer boolean ) } onSuccess Success callback with a chunk of data and information if more data will be provided later . @param { function ( string ) } onError Error callback .
function onReadFileRequested(options, onSuccess, onError) {
  var filePath = test_util.openedFiles[options.openRequestId];
  var continueRead = function() {
    if (options.fileSystemId !== test_util.FILE_SYSTEM_ID || !filePath) {
      onError('SECURITY');  
      return;
    }
    if (filePath === '/' + TESTING_TIRAMISU_FILE.name) {
      var textToSend = TESTING_TEXT.substr(options.offset, options.length);
      var textToSendInChunks = textToSend.split(/(?= )/);
      textToSendInChunks.forEach(function(item, index) {
        var reader = new FileReader();
        reader.onload = function(e) {
          onSuccess(
              e.target.result,
              index < textToSendInChunks.length - 1 );
        };
        reader.readAsArrayBuffer(new Blob([item]));
      });
      return;
    }
    if (filePath === '/' + TESTING_VANILLA_FOR_ABORT_FILE.name) {
      return;
    }
    if (filePath === '/' + TESTING_BROKEN_TIRAMISU_FILE.name) {
      onError('ACCESS_DENIED');  
      return;
    }
    onError('INVALID_OPERATION');  
  };
  if (readBreakpointCallback)
    readBreakpointCallback(filePath, continueRead);
  else
    continueRead();
}
function onReadFileRequested ( options , onSuccess , onError ) { var filePath = test_util . openedFiles [ options . openRequestId ] ; var continueRead = function ( ) { if ( options . fileSystemId !== test_util . FILE_SYSTEM_ID || ! filePath ) { onError ( 'SECURITY' ) ; return ; } if ( filePath === '/' + TESTING_TIRAMISU_FILE . name ) { var textToSend = TESTING_TEXT . substr ( options . offset , options . length ) ; var textToSendInChunks = textToSend . split ( / (?= ) / ) ; textToSendInChunks . forEach ( function ( item , index ) { var reader = new FileReader ( ) ; reader . onload = function ( e ) { onSuccess ( e . target . result , index < textToSendInChunks . length - 1 ) ; } ; reader . readAsArrayBuffer ( new Blob ( [ item ] ) ) ; } ) ; return ; } if ( filePath === '/' + TESTING_VANILLA_FOR_ABORT_FILE . name ) { return ; } if ( filePath === '/' + TESTING_BROKEN_TIRAMISU_FILE . name ) { onError ( 'ACCESS_DENIED' ) ; return ; } onError ( 'INVALID_OPERATION' ) ; } ; if ( readBreakpointCallback ) readBreakpointCallback ( filePath , continueRead ) ; else continueRead ( ) ; }
Requests reading contents of a file, previously opened with <code>
 openRequestId</code>.
Requests reading contents of a file previously opened with <code > openRequestId< / code > .
// enum ProviderError. // Convert item (string) to an ArrayBuffer. /* hasMore */ // Do nothing. This simulates a very slow read. // enum ProviderError. // enum ProviderError.