ZIP

The zip and unzip calls create or extract ZIP files.

Server setup

To use this module, you need to install yazl and yauzl on your server:

sudo apt install node-yazl node-yauzl

Account configuration

To use the ZIP calls, the account must have the zip flag set to true:

{"key": "...", "zip": true, "...": null}

JavaScript

Using Backend.js, PDF files can be concatenated as follows:

const backend = new Backend('https://viereck.ch/backend');
const account = backend.account('your-account-id', '44705748... your-account-key');

const sources = [
	{'#b': '7b8cf18d...', name: 'Plan.pdf'},
	...
	];
account.zip(sources, onDone, onError);

function onDone(token, request) {
	...
}

function onError(errorCode, request) {
	...
}
		

All PDF files must be uploaded beforehand, if necessary.

HTTP/REST Request

Creating a ZIP file

Request
POST /backend/zip
Account: ACCOUNT ID
Timestamp: TIMESTAMP
Signature: SIGNATURE
{"sources": [{"#b": randomHex(32)}, "..."]}
Response

200 with the blob token of the generated ZIP file

400 if a source file is missing

401 if the account ID or signature is missing or invalid

403 if the account is not allowed to use PDF concatenation

Account ID
Account key
Request

Extracting a ZIP file

Request
POST /backend/unzip
Account: ACCOUNT ID
Timestamp: TIMESTAMP
Signature: SIGNATURE
{"#b": randomHex(32)}
Response

200 with a list of extracted files and their blob tokens

400 if the source file is missing

401 if the account ID or signature is missing or invalid

403 if the account is not allowed to use PDF concatenation

Account ID
Account key
ZIP file blob token