T4S4  19.1 C8540 A23673
Teamcenter Gateway for SAP S/4HANA API Reference
BASE64 file handling

Functions

 tpco_b64tobinfile
 This function decodes a base64 string and writes the result into a file. More...
 
 tpco_filetob64
 This function reads the content of a file and encodes this to base64. More...
 

Detailed Description

Function Documentation

◆ tpco_b64tobinfile()

tpco_b64tobinfile

This function decodes a base64 string and writes the result into a file.

Parameters
base64stringthe base64 string
filenamefull filename for output
append(optional) append the output to the file (default= overwrite)
Returns
!= "" ERROR (see message)
1 set b64string [::base64::encode "Test Content"]
2 puts $b64string
3 tpco_b64tobinfile $b64string b64.txt
4 set clearstr [tpco_readfile b64.txt]
5 puts $clearstr
6 tpco_b64tobinfile $b64string b64.txt append
7 set clearstr [tpco_readfile b64.txt]
8 puts $clearstr
9 
10 output:
11 VGVzdCBDb250ZW50
12 Test Content
13 Test ContentTest Content

◆ tpco_filetob64()

tpco_filetob64

This function reads the content of a file and encodes this to base64.

Parameters
filenamethe input filename
Returns
the file-content as base64 string / -1= ERROR
1 set b64content [tpco_filetob64 [rcwd]/var/httpd/img/application.png]
2 puts $b64content
3 
4 output:
5 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYm...