Interface JSZip

Index

Methods

Methods

public clone(): JSZip

Clone JSSZip instance

return {JSZip} cloned instsance

Returns

JSZip

public crc32(data: string, crc?: number): number

Calculate crc32 of given string

Parameters

  • data: string

    string to calculate crc32 from

  • crc?: number optional

    optional: initializer for crc calc

Returns

number

calculated crc32 number

public file(path: string): JSZipFile

Get a file from the archive

Parameters

  • path: string

    relative path to file

Returns

JSZipFile

file matching path, null if no file found

public file(path: RegExp): JSZipFile[]

Get files matching a RegExp from archive

Parameters

  • path: RegExp

    RegExp to match

Returns

JSZipFile[]

return all matching files or an empty array

public file(path: string, content: any, options?: JSZipOptions): JSZip

Add a file to the archive

Parameters

  • path: string

    relative path to file

  • content: any

    content of the file

  • options?: JSZipOptions optional

    optional information about the file

Returns

JSZip

JSZip object

public filter(predicate: (relativePath: string, file: jszip.JSZipFile) => boolean): JSZipFile[]

Get all files wchich match the given filter function

Parameters

  • predicate: (relativePath: string, file: jszip.JSZipFile) => boolean

Returns

JSZipFile[]

array of matched elements

public folder(name: string): JSZip

Return an new JSZip instance with the given folder as root

Parameters

  • name: string

    name of the folder

Returns

JSZip

new JSZip object with the given folder as root or null

public folder(name: RegExp): JSZipFile[]

Returns new JSZip instances with the matching folders as root

Parameters

  • name: RegExp

    RegExp to match

Returns

JSZipFile[]

new array of JSZipFile objects which match the RegExp

public generate(options?: JSZipGeneratorOptions): any

Generates a new archive

Parameters

Returns

any

the serialized archive

public load(data: any, options: JSZipOptions): JSZip

Deserialize zip file

Parameters

  • data: any

    serialized zip file

  • options: JSZipOptions

    options for deserializing

Returns

JSZip

returns the JSZip instance

public remove(path: string): JSZip

Removes the file or folder from the archive

Parameters

  • path: string

    relative path of file or folder

Returns

JSZip

returns the JSZip instance

public utf8decode(data: string): string

UTF8 decode a string

Parameters

  • data: string

    string to decode

Returns

string

public utf8encode(data: string): string

UTF8 encode a string

Parameters

  • data: string

    string to encode

Returns

string