infinity.quotedPrintable¶
Provides Quoted-printable-encoding and decoding functionality for strings, files and streams.
Module: infinity.encoding
Example:
infinity.loadModule('infinity.encoding');
let encodedData = infinity.quotedPrintable.encode('AUO_ÄÜÖ ß-"+&,?.<=>');
console.debug(encodedData);
//AUO=5F=C4=DC=D6 =DF-"+&,?.<=3D>
encodedData = infinity.quotedPrintable.encode('AUO_ÄÜÖ ß-"+&,?.<=>', true);
console.debug(encodedData);
//AUO=5F=C4=DC=D6_=DF-=22+&=2C=3F.=3C=3D=3E
let decodedData = infinity.quotedPrintable.decode(encodedData, true);
console.debug(decodedData);
//AUO_ÄÜÖ ß-"+&,?.<=>
decode()¶
Attempts to decode the given string from quoted-printable and returns the results.
Signature:
decode( value: string, headerField?: boolean ): string
Parameters:
-
value:
string
The string to decode.
-
headerField:
boolean
, optionalTrue for decoding non-printing characters like spaces as well.
Return type: string
Example:
infinity.loadModule('infinity.encoding');
let decodedData = infinity.quotedPrintable.decode(encodedData);
decodeFile()¶
Reads out the contents of the given file, attempts to decode them from quoted-printable and returns the results.
Signature:
decodeFile( fileName: string ): string
Parameters:
- fileName:
string
Filename, relative path (location relative to the folder with the used INFINITY.JS executable file) or absolute path to encoded file.
Return type: string
Example:
infinity.loadModule('infinity.encoding');
let decodedData = infinity.quotedPrintable.decodeFile('encodedData.txt');
decodeFile()¶
Reads out the contents of the given file, attempts to decode them from quoted-printable and writes the results to a file at the given location.
Signature:
decodeFile( inFileName: string, outFileName: string ): void
Parameters:
-
inFileName:
string
Filename, relative path (location relative to the folder with the used INFINITY.JS executable file) or absolute path to encoded file.
-
outFileName:
string
Filename, relative path (location relative to the folder with the used INFINITY.JS executable file) or absolute path to the file which should contain the decoded output.
Example:
infinity.loadModule('infinity.encoding');
infinity.quotedPrintable.decodeFile('encodedData.txt', 'decodedData.txt');
decodeStream()¶
Reads the contents of the given stream, attempts to decode them from quoted-printable and writes the results to another given stream.
Signature:
decodeStream( inStream: infinity.stream, outStream: infinity.stream ): void
Parameters:
-
inStream:
infinity.stream
The stream object to decode from. See infinity.stream.
-
outStream:
infinity.stream
The stream object to write to. See infinity.stream.
Example:
infinity.loadModule('infinity.encoding');
infinity.quotedPrintable.decodeStream(inStream, outStream);
encode()¶
Encodes the given string with quoted-printable and returns the results.
Signature:
encode( value: string, headerField?: boolean ): string
Parameters:
-
value:
string
The string to encode.
-
headerField:
boolean
, optionalTrue for encoding non-printing characters like spaces as well.
Return type: string
Example:
infinity.loadModule('infinity.encoding');
let encodedData = infinity.quotedPrintable.encode(dataToEncode, true);
encodeFile()¶
Reads out the contents of the given file, encodes them to quoted-printable and writes the results to a file at the given location.
Signature:
encodeFile( inFileName: string, outFileName: string ): void
Parameters:
-
inFileName:
string
Filename, relative path (location relative to the folder with the used INFINITY.JS executable file) or absolute path to the file which has to be encoded.
-
outFileName:
string
Filename, relative path (location relative to the folder with the used INFINITY.JS executable file) or absolute path to the file which should contain the encoded output.
Example:
infinity.loadModule('infinity.encoding');
infinity.quotedPrintable.encodeFile('dataToEncode.txt', 'encodedData.txt');
encodeFile()¶
Reads out the contents of the given file, encodes them to quoted-printable and returns the results.
Signature:
encodeFile( fileName: string ): string
Parameters:
- fileName:
string
Filename, relative path (location relative to the folder with the used INFINITY.JS executable file) or absolute path to the file which has to be encoded.
Return type: string
Example:
infinity.loadModule('infinity.encoding');
let encodedData = infinity.quotedPrintable.encodeFile('dataToEncode.txt');
encodeStream()¶
Reads the contents of the given stream, encodes them to quoted-printable and writes the results to another given stream.
Signature:
encodeStream( inStream: infinity.stream, outStream: infinity.stream ): void
Parameters:
-
inStream:
infinity.stream
The stream object to encode. See infinity.stream.
-
outStream:
infinity.stream
The stream object to write to. See infinity.stream.
Example:
infinity.loadModule('infinity.encoding');
infinity.quotedPrintable.encodeStream(inStream, outStream);