Encoder
Availability table
Module |
Available |
|---|---|
encoder controller
Provides generic data encoding, decoding, and normalization utilities, including support for Base64, Base32, Base16, URL encoding, and text normalization.
- encoder.base16Decode(base16: string)
Decode the provided base16 string base16 to a byte array
- Arguments:
base16 – Object to compare filter with.
- Returns:
Decoded byte array
- encoder.base16DecodeToString(base16: string)
Decode the provided base16 string base16 to a UTF-8 string
- Arguments:
base16 – Base16 string to decode
- Returns:
Decoded UTF-8 string
- encoder.base16Encode(bytes: number[])
Encode the provided byte array bytes to a base16 string
- Arguments:
bytes – Byte array to encode
- Returns:
Base16 encoded string
- encoder.base16EncodeString(text: string)
Encode the provided UTF-8 string text to a base16 string
- Arguments:
text – UTF-8 string to encode
- Returns:
Base16 encoded string
- encoder.base32Decode(base32: string)
Decode the provided base32 string base32 to a byte array
- Arguments:
base32 – Object to compare filter with.
- Returns:
Decoded byte array
- encoder.base32DecodeToString(base32: string)
Decode the provided base32 string base32 to a UTF-8 string
- Arguments:
base32 – Base32 string to decode
- Returns:
Decoded UTF-8 string
- encoder.base32Encode(bytes: number[])
Encode the provided byte array bytes to a base32 string
- Arguments:
bytes – Byte array to encode
- Returns:
Base32 encoded string
- encoder.base32EncodeString(text: string)
Encode the provided UTF-8 string text to a base32 string
- Arguments:
text – UTF-8 string to encode
- Returns:
Base32 encoded string
- encoder.base64Decode(base64: string)
Decode the provided base64 string base64 to a byte array
- Arguments:
base64 – Object to compare filter with.
- Returns:
Decoded byte array
- encoder.base64DecodeToString(base64: string)
Decode the provided base64 string base64 to a UTF-8 string
- Arguments:
base64 – Base64 string to decode
- Returns:
Decoded UTF-8 string
- encoder.base64Encode(bytes: number[])
Encode the provided byte array bytes to a base64 string
- Arguments:
bytes – Byte array to encode
- Returns:
Base64 encoded string
- encoder.base64EncodeString(text: string)
Encode the provided UTF-8 string text to a base64 string
- Arguments:
text – UTF-8 string to encode
- Returns:
Base64 encoded string
- encoder.convertEncoding(input: string, sourceCharset: string, targetCharset: string)
Format the provided string input from a specific charset to an another charset. The list of available charsets can be found in the Java documentation here, under the “Standard charsets” section. Example: encoder.convertEncoding(“桯污”, “UTF-16BE”, “UTF-8”) -> “hola”
- Arguments:
input – String to transform
sourceCharset – Source charset to decode the input string
targetCharset – Target charset to encode the output string
- Returns:
Transformed string
- encoder.normalize(rawText: string)
Normalize the provided string rawText to a normalized string
- Arguments:
rawText – String to normalize
- Returns:
Normalized string
- encoder.urlDecode(encodedUrl: string)
Decode the provided url encoded string encodedUrl to a decoded string
- Arguments:
encodedUrl – Url encoded UTF-8 string to decode
- Returns:
Decoded string
- encoder.urlEncode(rawText: string)
Encode the provided string rawText to a url encoded string
- Arguments:
rawText – UTF-8 string to encode
- Returns:
Url encoded string