Skip to main content

Raffaello_Zip

new Raffaello_Zip()

Usage


// Declarer a new zip instance
const myZip = new Raffaello_Zip();

// Add files
await myZip.addFile('path/in/zip', blob);
await myZip.addFile('path/in/zip', blob);

// Download the zip
await myZip.download('myProject.zip');

Initiated Properties

PropertyTypeDescription
this.filesarrayAn array that store the files added to the zip. Each file is represented as a path string.

Public Methods

addFile()

Method to add a file to the zip.

Usage
await myZip.addFile('path/in/zip', blob);

Parameters:

NameRequiredTypeDefaultDescription
pathstringnullThe path where the file will be stored in the zip.
blobBlobnullThe file content as a Blob.

Returns:

void — This method performs a side effect (add the file to the zip). It does not return any value.


download()

Method to trigger the download of the zip file.

Usage
await myZip.download('myProject.zip');

Parameters:

NameRequiredTypeDefaultDescription
filenamestringnullThe name of the zip file to be downloaded.

Returns:

void — This method performs a side effect (trigger the download of the zip file). It does not return any value.