mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
781 B
34 lines
781 B
name: duk_base64_encode
|
|
|
|
proto: |
|
|
const char *duk_base64_encode(duk_context *ctx, duk_idx_t idx);
|
|
|
|
stack: |
|
|
[ ... val! ... ] -> [ ... base64_val! ... ]
|
|
|
|
summary: |
|
|
<p>Coerces an arbitrary value into a buffer and then encodes the result
|
|
into base-64 as an in-place operation. Returns a pointer to the resulting
|
|
string for convenience.</p>
|
|
|
|
<div class="note">
|
|
Coercing to a buffer first coerces a non-buffer value into a string, and
|
|
then coerces the string into a buffer. The resulting buffer contains the
|
|
string in CESU-8 encoding.
|
|
</div>
|
|
|
|
example: |
|
|
duk_push_string(ctx, "foo");
|
|
printf("base-64 encoded: %s\n", duk_base64_encode(ctx, -1));
|
|
|
|
/* Output:
|
|
* base-64 encoded: Zm9v
|
|
*/
|
|
|
|
tags:
|
|
- codec
|
|
|
|
seealso:
|
|
- duk_base64_decode
|
|
|
|
introduced: 1.0.0
|
|
|