IPWorks ZIP 2020 JavaScript Edition

Questions / Feedback?

IncludeFiles Method

Specifies that the indicated files should be added to the archive.


async zip.includeFiles(filenames : string): Promise<void>


IncludeFiles may be used before Compress, to specify the files to be compressed. Invoking this method populates the Files collection accordingly.

Invoking the method does not create or alter the archive.

The argument should be a pipe ("|") -delimited sequence of one or more filenames. The filenames should be specified with paths if necessary, so that the files may be found on the local file system. The filenames will be stored as is in the FilesDecompressedName field, and without a pathname in the FilesCompressedName field of the Files collection.

Filenames may include the wildcards '?', '*', and '[ .. ]'. '?' will match any single character, and '*' will match an arbitrary sequence of characters. '[ .. ]' may be used to match any of the characters inside, or a range, such as '[a-z]'. A '\' can be used to escape wildcard characters.

If wildcards are specified, the file system will be scanned and all files matching the specified mask will be added. Moreover, subdirectories will be recursed into if RecurseSubdirectories is set to true. When recursing into subdirectories, relative path information will be stored in FilesCompressedName field of the Files collection.

The ExcludedFiles may be used to limit the files to be compressed. This property is checked when Compress is invoked, rather than when IncludeFiles is invoked, so this property may be set before or after invoking IncludeFiles.

Note that invoking IncludeFiles will not reset the class, or remove old values of FilesCompressedName and FilesDecompressedName. This may be done by first clearing the Files collection.


ZipControl.IncludeFiles("c:\test\* | c:\readme")
ZipControl.ExcludedFiles = "*.tmp"

Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks ZIP 2020 JavaScript Edition - Version 20.0 [Build 7720]