$k. Zip

new Zip(archiveNameOrEntityopt)

Creates a new ZIP Archive

Parameters:
NameTypeAttributesDescription
archiveNameOrEntitystring | $k.NetEntity | $k.Blob<optional>

The name of archive, a NetEntity or a blob. If a NetEntity or a Blob are provided, then the file entries will be read from that source.

Creates a zipped entity from all entities passed to the archive

Version
  • Experimental feature, might be removed at any time
Since
  • 5.0.1

Extends

Methods

addEntry(entity, filenameopt)

Add entity to archive

Parameters:
NameTypeAttributesDescription
entity$k.Blob | $k.NetEntity

The new entry

filenamestring<optional>

The filename within the archive

Throws:

If the archive is already closed

Type
$k.exception.RuntimeError

addFolder(foldername) → {$k.ZipDirectory}

Add folder to archive

Parameters:
NameTypeDescription
foldernamestring

Name of the subfolder

Returns:

The new folder

Type: 
$k.ZipDirectory

build(archiveName) → {$k.NetEntity}

close the archive and return a zip entity

Parameters:
NameTypeDescription
archiveNamestring

The filename of the NetEntity

Returns:

The zip-file as NetEntity

Type: 
$k.NetEntity

directories()

Returns the directories

Version
  • Experimental feature, might be removed at any time

entry(filename) → {$k.NetEntity}

Returns the entry at the given filename

Parameters:
NameTypeDescription
filenamestring

Filename of the entry

Version
  • Experimental feature, might be removed at any time
Returns:

The entry

Type: 
$k.NetEntity

filename()

Returns the filename

Version
  • Experimental feature, might be removed at any time

filenames()

Returns the entry filenames

Version
  • Experimental feature, might be removed at any time