src/unzip.js
async function pakoUnzip(inputData) {
  let strm
  let pos = 0
  let i = 0
  const chunks = []
  let inflator
  do {
    const remainingInput = inputData.slice(pos)
    inflator = new Inflate()
    strm = inflator.strm
    inflator.push(remainingInput, Z_SYNC_FLUSH)
    if (inflator.err) throw new Error(inflator.msg)

    pos += strm.next_in
    chunks[i] = Buffer.from(inflator.result)
    i += 1
  } while (strm.avail_in)

  const result = Buffer.concat(chunks)
  return result
}
async function pakoUnzip(inputData) {
  let strm
  let pos = 0
  let i = 0
  const chunks = []
  let inflator
  do {
    const remainingInput = inputData.slice(pos)
    inflator = new Inflate()
    strm = inflator.strm
    inflator.push(remainingInput, Z_SYNC_FLUSH)
    if (inflator.err) throw new Error(inflator.msg)

    pos += strm.next_in
    chunks[i] = Buffer.from(inflator.result)
    i += 1
  } while (strm.avail_in)

  const result = Buffer.concat(chunks)
  return result
}
async function pakoUnzip ( inputData ) { let strm let pos = 0 let i = 0 const chunks = [ ] let inflator do { const remainingInput = inputData . slice ( pos ) inflator = new Inflate ( ) strm = inflator . strm inflator . push ( remainingInput , Z_SYNC_FLUSH ) if ( inflator . err ) throw new Error ( inflator . msg ) pos += strm . next_in chunks [ i ] = Buffer . from ( inflator . result ) i += 1 } while ( strm . avail_in ) const result = Buffer . concat ( chunks ) return result }
browserify-zlib, which is the zlib shim used by default in webpacked code, does not properly uncompress bgzf chunks that contain more than one bgzf block, so export an unzip function that uses pako directly if we are running in a browser.
browserify - zlib which is the zlib shim used by default in webpacked code does not properly uncompress bgzf chunks that contain more than one bgzf block so export an unzip function that uses pako directly if we are running in a browser .