src/file/FileUtils.js
function readAsText(file) {
        var result = new $.Deferred();

        // Measure performance
        var perfTimerName = PerfUtils.markStart("readAsText:\t" + file.fullPath);
        result.always(function () {
            PerfUtils.addMeasurement(perfTimerName);
        });

        // Read file
        file.read(function (err, data, encoding, stat) {
            if (!err) {
                result.resolve(data, stat.mtime);
            } else {
                result.reject(err);
            }
        });

        return result.promise();
    }
function readAsText(file) {
        var result = new $.Deferred();

        // Measure performance
        var perfTimerName = PerfUtils.markStart("readAsText:\t" + file.fullPath);
        result.always(function () {
            PerfUtils.addMeasurement(perfTimerName);
        });

        // Read file
        file.read(function (err, data, encoding, stat) {
            if (!err) {
                result.resolve(data, stat.mtime);
            } else {
                result.reject(err);
            }
        });

        return result.promise();
    }
function readAsText ( file ) { var result = new $ . Deferred ( ) ; // Measure performance var perfTimerName = PerfUtils . markStart ( "readAsText:\t" + file . fullPath ) ; result . always ( function ( ) { PerfUtils . addMeasurement ( perfTimerName ) ; } ) ; // Read file file . read ( function ( err , data , encoding , stat ) { if ( ! err ) { result . resolve ( data , stat . mtime ) ; } else { result . reject ( err ) ; } } ) ; return result . promise ( ) ; }
Asynchronously reads a file as UTF-8 encoded text.
@param {!File} file File to read
@return {$.Promise} a jQuery promise that will be resolved with the
file's text content plus its timestamp, or rejected with a FileSystemError string
constant if the file can not be read.
Asynchronously reads a file as UTF - 8 encoded text .