How to use the yauzl.fromRandomAccessReader function in yauzl

To help you get started, we’ve selected a few yauzl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TimelordUK / jspurefix / src / util / unzip.js View on Github external
fd: fd,
          // shift the start and end offsets
          start: start + offsetArg,
          end: end + offsetArg - 1, // the -1 is because fs.createReadStream()'s end option is inclusive
          autoClose: false
        })
      }
      MiddleOfFileReader.prototype.read = function (buffer, offset, length, position, callback) {
        // shift the position
        fs.read(fd, buffer, offset, length, position + offsetArg, callback)
      }
      MiddleOfFileReader.prototype.close = function (callback) {
        fs.close(fd, callback)
      }

      yauzl.fromRandomAccessReader(new MiddleOfFileReader(), endArg - offsetArg, options, handleZipFile)
    })
  })