Skip to content

Repository files navigation

cozip_reader

DuckDB extension for reading Flat-profile cozip archives.

Install

INSTALL cozip FROM community;
LOAD cozip;

Linux, macOS and Windows. WebAssembly is not supported.

Read an archive

SELECT *
FROM read_flat('dataset.zip');

The result contains name, offset, size, any user metadata, and a cozip:location path for each file.

Remote archives work through DuckDB's httpfs extension. These public examples contain the same Flat archive:

-- Source Cooperative
SELECT * FROM read_flat(
  'https://data.source.coop/asterisk-labs/cozip-api-fixtures/data/cities.zip'
);

-- Hugging Face, pinned to a revision
SELECT * FROM read_flat(
  'hf://datasets/asterisk-labs/cozip-api-fixtures@v0.1.0/data/cities.zip'
);

Pass location := false when only the manifest is needed:

SELECT * FROM read_flat('dataset.zip', location := false);

cozip_profile() reads only the archive bootstrap and returns the raw profile byte. read_flat() accepts profile 1 and rejects every other profile.

SELECT cozip_profile('dataset.zip'); -- 1 for Flat

Compatibility

The original API remains available. read_cozip() emits the legacy cozip:gdal_vsi column, and gdal_vsi remains accepted by read_flat() as an alias for location.

SELECT * FROM read_cozip('dataset.zip', gdal_vsi := true);
SELECT * FROM read_flat('dataset.zip', gdal_vsi := false);

Build

git clone --recurse-submodules https://github.com/asterisk-labs/cozip_reader
cd cozip_reader
make
make test

License

MIT


Made with ♥ by

Asterisk Labs

About

Read Cloud-Optimized ZIP files

Resources

Stars

8 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages