Seek into local files with the File System API
Google Developers Logo

Missed the Chrome Developer Summit?

All sessions available on demand - Watch Now

If you have a File object (say, one stored using the FileSystem API), it’s possible to seek into it and read chunks without reading the entire file into memory:

var url = "filesystem:";

window.webkitResolveLocalFileSystemURL(url, function(fileEntry) {
  fileEntry.file(function(file) {
    var reader = new FileReader();

    reader.onload = function(e) {
      var ab =; // arrayBuffer containing bytes 0-10 of file.
      var uInt8Arr = new Uint8Array(ab);

    var blob = file.webkitSlice(0, 10, "application/zip");  // mimetype is optional
  }, errorHandler);
}, errorHandler);

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License. For details, see our Terms of Service.