Zum Hauptinhalt springen

ZIP Files

Purpose and Use Case

The zbsync_zipper module adds the ZIP File Grabber (zbs.grabber.zipper), which extracts a ZIP archive and returns its files to the pipeline. There is currently no dedicated ZIP dumper (for writing/compressing files into an archive).

The worker doesn't fetch the archive itself — it reads the ZIP content from the record it receives, so it's typically placed right after a File Grabber, FTP Grabber, or similar worker that has just downloaded a .zip file.

Configuration

FieldDescription
GlobPattern applied to the extracted files to select which ones are returned (default *, i.e. all files).

How It Works

  • Reads the incoming record's content/filecontent as ZIP archive bytes.
  • Extracts the entire archive into a temporary directory.
  • Walks the extracted tree with the configured Glob pattern (recursively, via rglob), skipping directories.
  • Returns one record per matched file: {"filename", "filepath", "filecontent"}, where filepath is relative to the archive root.
  • The temporary extraction directory is always cleaned up afterwards, even if an error occurs.

Usage and Best Practices

Common Pitfalls

  • No archive content: if the upstream record has no content (e.g. a failed download), the worker returns nothing rather than raising an error — check earlier workers if a ZIP Grabber unexpectedly produces no records.
  • Glob matches nested paths: because the glob is applied recursively across the whole extracted tree, a plain *.csv also matches CSV files inside subfolders of the archive, not just top-level ones.