How to use the yauzl.open 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 orangewise / s3-zip / test / test-s3-zip-alt-names.js View on Github external
archive.on('close', function () {
    console.log('+++++++++++')
    yauzl.open(join(__dirname, '/test-alt.zip'), function (err, zip) {
      if (err) console.log('err', err)
      zip.on('entry', function (entry) {
        // console.log(entry);
        child.same(entry.fileName, file1Alt)
        child.same(entry.compressedSize, 11)
        child.same(entry.uncompressedSize, 20)
      })

      zip.on('close', function () {
        child.end()
      })
    })
  })
  child.type(archive, 'object')
github hanhdt / esp32-flash-tool / src / main / unzip_image.js View on Github external
export default function processCompressedFile (mainWindow, zipParams) {
  yauzl.open(zipParams.filePath, zipParams.options, (err, zipFile) => {
    if (err) throw err

    zipFile.on('error', (err) => {
      throw err
    })

    zipFile.on('entry', (entry) => {
      // console.log('File:', entry.fileName)
      zipFile.openReadStream(entry, (err, readStream) => {
        if (err) throw err

        if (zipParams.target === entry.fileName) {
          saveFile(mainWindow, zipParams, entry.fileName, readStream)
        }
      })
    })
github perliedman / node-hgt / src / imagico.js View on Github external
return new Promise(function(fulfill, reject) {
        var unzips = [];

        yauzl.open(zipPath, function(err, zipfile) {
            if (err) {
                reject(err);
                return;
            }
            zipfile
            .on('entry', function(entry) {
                if (/\/$/.test(entry.fileName)) {
                    return;
                }
                zipfile.openReadStream(entry, function(err, readStream) {
                    var lastSlashIdx = entry.fileName.lastIndexOf('/'),
                        fileName = entry.fileName.substr(lastSlashIdx + 1),
                        filePath = path.join(targetPath, fileName);
                    if (err) {
                        reject(err);
                        return;
github PublicI / fec-loader / src / util / fec / unzip.js View on Github external
function unzipFile(file,cb) {
    console.log(file);

    yauzl.open(file, {
            autoClose: false
        }, function(err, zipfile) {
        if (err) throw err;

        filingQueue.drain = null;

        zipfile.on('entry', function(entry) {
            if (entry.fileName.indexOf('.fec') !== -1) {

                filingQueue.push({
                    name: entry.fileName,
                    openStream: function (cb) {
                        zipfile.openReadStream(entry, cb);
                    }
                });
github openstf / adbkit-apkreader / lib / apkreader.js View on Github external
return Promise.fromCallback(callback => {
      return Zip.open(this.apk, {lazyEntries: true}, callback)
    })
  }
github vadimcn / vscode-lldb / extension / install.ts View on Github external
return new Promise((resolve, reject) =>
        zip.open(zipPath, { lazyEntries: true }, (err, zipfile) => {
            if (err) {
                reject(err);
            } else {
                zipfile.readEntry();
                zipfile.on('entry', (entry: zip.Entry) => {
                    callback(entry).then(outstream => {
                        if (outstream != null) {
                            zipfile.openReadStream(entry, (err, zipstream) => {
                                if (err) {
                                    reject(err);
                                } else {
                                    outstream.on('error', reject);
                                    zipstream.on('error', reject);
                                    zipstream.on('end', () => zipfile.readEntry());
                                    zipstream.pipe(outstream);
                                }
github noobaa / noobaa-core / src / util / zip_utils.js View on Github external
    return P.fromCallback(cb => yauzl.open(file_path, UNZIP_OPTIONS, cb));
}
github elastic / kibana / packages / kbn-es / src / utils / decompress.js View on Github external
return new Promise((resolve, reject) => {
    yauzl.open(input, { lazyEntries: true }, (err, zipfile) => {
      if (err) {
        reject(err);
      }

      zipfile.readEntry();

      zipfile.on('close', () => {
        resolve();
      });

      zipfile.on('error', err => {
        reject(err);
      });

      zipfile.on('entry', entry => {
        const zipPath = entry.fileName
github commonshost / dohnut / source / getPopularDomains.js View on Github external
return new Promise((resolve, reject) => {
    yauzl.open(archivepath, { lazyEntries: true }, (error, zipfile) => {
      if (error) return reject(error)
      zipfile.readEntry()
      zipfile.on('entry', (entry) => {
        if (entry.fileName !== entrypath) {
          return reject(new Error('Unexpected file in archive'))
        }
        zipfile.openReadStream(entry, (error, readStream) => {
          if (error) return reject(error)
          readStream.on('error', reject)
          const file = createWriteStream(csvpath)
          readStream.pipe(file)
          readStream.on('end', resolve)
        })
      })
      zipfile.on('end', () => reject(new Error('Empty archive')))
    })
github ryceg / Eigengrau-s-Essential-Establishment-Generator / scripts / install-compiler.js View on Github external
function unzip () {
      yauzl.open(filePath, { lazyEntries: true }, (error, zip) => {
        if (error) throw error

        utils.logAction('Unzipping...\n')

        zip.on('entry', entry => isFolder(entry) ? zip.readEntry() : unzipEntry(zip, entry))
        zip.on('end', resolve)
        zip.readEntry()
      })
    }
  })