No results for ""

Powered byAlgolia

b64decode( input, [encoding] )

suggest edits

Decode the passed base64 encoded input string into the unencoded original string.

inputstringThe string to base64 decode.
encoding (optional)stringThe base64 encoding to use.
Available options are:
- "std": the standard encoding with = padding chars and + and / characters in encoding alphabet. This is the default.
- "rawstd": like std but without = padding characters.
- "url": URL safe version of std, encoding alphabet doesn't contain + and / characters, but rather - and _ characters.
- "rawurl": like url but without = padding characters.


stringThe base64 decoded version of the input string.


import { check } from "k6";
import encoding from "k6/encoding";

export default function() {
    let str = "hello world";
    let enc = "aGVsbG8gd29ybGQ=";
    check(null, {
        "is encoding correct": () => encoding.b64encode(str) === enc,
        "is decoding correct": () => encoding.b64decode(enc) === str