T4S4  19.1 C8540 A23673
Teamcenter Gateway for SAP S/4HANA API Reference
ZIP data handling

Functions

 tpco_compressFile2B64
 This function reads a file and returns the contents as a zipped B64String. More...
 
 tpco_compressString2B64
 This function zips a string and returns the result as B64. More...
 
 tpco_createZipFromDir
 This function creates a ziparchive from a directory. More...
 
 tpco_createZipFromFileList
 This function creates a ziparchive from a filelist. More...
 
 tpco_extractZIPFile
 This function unzips a ziparchive. More...
 
 tpco_getFileListFromZip
 This function lists all files in a ziparchive. More...
 
 tpco_packfile
 This function zips a file. More...
 
 tpco_uncompressB642File
 This function unzips a B64string and writes the result into a file. More...
 
 tpco_uncompressB64Str
 This function unzips a B64string (see tpco_compressString2B64) More...
 
 tpco_unpackfile
 This function unzips a file. More...
 

Detailed Description

Function Documentation

◆ tpco_compressFile2B64()

tpco_compressFile2B64

This function reads a file and returns the contents as a zipped B64String.

Parameters
filethe full filename
Returns
the compressed file or ERROR=empty string
1 puts [tpco_compressFile2B64 9ada3e.sig]
2 output
3 
4 eNrFfUmvLDty3t6/gktrIYFTcNBOttuwDcEL23shM8mU2pC6jR4MAYL+uyOCzKmyqm4mk0fu1+++c8499QXHmBjDH/OfxB9/+/e/+/f/5Td/...

◆ tpco_compressString2B64()

tpco_compressString2B64

This function zips a string and returns the result as B64.

Parameters
stringthe string
Returns
the compressed string or ERROR=empty string
1 set cs "0123456787901234567879012345678790123456787901234567879012345678790123456787901234567879012345678790123456787901234567879"
3 
4 output
5 eF4zMDQyNjE1M7cwtzSgKxMA7NUY7Q==

◆ tpco_createZipFromDir()

tpco_createZipFromDir

This function creates a ziparchive from a directory.

Parameters
dirthe path of the directory
zipnamethe name of ziparchive
pathstore0= realtive path 1=absolute path stored in zipfile
recursivefile search 0= recursive off 1= recursive on
Returns
0= OK 1=ERROR

Zip all files in the directory [rcwd]/var/httpd and sub directories.

1 tpco_createZipFromDir [rcwd]/var/httpd httpd.zip 0 1

◆ tpco_createZipFromFileList()

tpco_createZipFromFileList

This function creates a ziparchive from a filelist.

Parameters
zipnamethe name of zipfile
filelistinfile storefilename infile storefilename infile storefilename ...
Returns
0= OK 1=ERROR
1 tpco_createZipFromFileList list.zip 9ada3e.sig sig.file example.tcl test.tcl appsmake hello.script
2 puts [tpco_getFileListFromZip list.zip]
3 
4 output:
5 {sig.file} {test.tcl} {hello.script}

◆ tpco_extractZIPFile()

tpco_extractZIPFile

This function unzips a ziparchive.

Parameters
zipnamethe name of ziparchive
targetdir(optional) traget directory for the files (default=cwd)
Returns
0= OK 1=ERROR
1 tpco_extractZIPFile list.zip [rcwd]/tmp

◆ tpco_getFileListFromZip()

tpco_getFileListFromZip

This function lists all files in a ziparchive.

Parameters
zipnamethe name of ziparchive
Returns
tcl list of filenames
1 puts [tpco_getFileListFromZip httpd.zip]
2 
3 output:
4 {applicationMenu.xml} {index.html} {languages/language_ru_Russian.properties} {languages/language_zh-TW_Chinese-Taiwan.properties} {languages/language_zh-CN_Chinese-China.properties} ...

◆ tpco_packfile()

tpco_packfile

This function zips a file.

Parameters
infile_namethe input file
outfile_namethe new zip file
Returns
tcl list {0 compress_level}

Zip the file [rcwd]/9ada3e.sig and write the result to [rcwd]/9ada3e.sig.zip.

1 puts [tpco_packfile [rcwd]/9ada3e.sig [rcwd]/9ada3e.sig.zip]
2 
3 output:
4 0 1.00

◆ tpco_uncompressB642File()

tpco_uncompressB642File

This function unzips a B64string and writes the result into a file.

Parameters
zipb64stringthe b64 string
filethe full filename
Returns
0= OK 1= Error
1 tpco_uncompressB642File eF4zMDQyNjE1M7cwtzSgKxMA7NUY7Q== test.txt

◆ tpco_uncompressB64Str()

tpco_uncompressB64Str

This function unzips a B64string (see tpco_compressString2B64)

Parameters
stringthe B64 string
Returns
the uncompressed string or ERROR=empty string
1 puts [tpco_uncompressB64Str eF4zMDQyNjE1M7cwtzSgKxMA7NUY7Q==]
2 
3 output
4 0123456787901234567879012345678790123456787901234567879012345678790123456787901234567879012345678790123456787901234567879

◆ tpco_unpackfile()

tpco_unpackfile

This function unzips a file.

Parameters
infile_namethe input file
outfile_namethe new zip file
Returns
0= OK -1=ERROR

Unzip the file [rcwd]/9ada3e.sig.zip and write the result to [rcwd]/9ada3e.sig.unzip.

1 tpco_unpackfile [rcwd]/9ada3e.sig.zip [rcwd]/9ada3e.sig.unzip