Skip to content

Function: zipParts() ​

ts
function zipParts(parts, options?): Uint8Array;

Defined in: write.ts:163

Packs already-generated components into a zip archive.

Useful when you need the individual parts for something else as well and would rather not run the conversion twice. Synchronous: by the time you hold a ShapefileParts, the WebAssembly work is already done.

Parameters ​

ParameterTypeDescription
partsShapefilePartsThe result of writeShapefile.
optionsPick<ZipOptions, "fileName" | "level">fileName for the base name inside the archive (default "shapefile"), level for the DEFLATE level 0-9 (default 6).

Returns ​

Uint8Array

The zip archive as bytes.

Example ​

ts
const parts = await writeShapefile(data, { epsg: 4326 });
await uploadForPreview(parts.shp);
const zip = zipParts(parts, { fileName: 'parcels' });

Released under the MIT License.