PHP 8.2.30
Preview: gunzip-maybe.js Size: 572 B
//opt/alt/alt-nodejs9/root/lib/node_modules/npm/node_modules/pacote/lib/util/gunzip-maybe.js

'use strict'

const duplex = require('mississippi').duplex
const through = require('mississippi').through
const zlib = require('zlib')

function hasGzipHeader (c) {
  return c[0] === 0x1F && c[1] === 0x8B && c[2] === 0x08
}

module.exports = gunzip
function gunzip () {
  const stream = duplex()
  const peeker = through((chunk, enc, cb) => {
    const newStream = hasGzipHeader(chunk)
    ? zlib.createGunzip()
    : through()
    stream.setReadable(newStream)
    stream.setWritable(newStream)
    stream.write(chunk)
  })
  stream.setWritable(peeker)
  return stream
}

Directory Contents

Dirs: 0 × Files: 6

Name Size Perms Modified Actions
129 B lrw-r--r-- 2021-09-28 11:28:21
Edit Download
5.72 KB lrw-r--r-- 2021-09-28 11:28:21
Edit Download
572 B lrw-r--r-- 2021-09-28 11:28:21
Edit Download
1.81 KB lrw-r--r-- 2021-09-28 11:28:21
Edit Download
1.02 KB lrw-r--r-- 2021-09-28 11:28:21
Edit Download
186 B lrw-r--r-- 2021-09-28 11:28:21
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).