Movatterモバイル変換


[0]ホーム

URL:


GitHub

Base64

Base64.Base64Module
Base64

Functionality forbase64 encoding and decoding, a method to represent binary data using text, common on the web.

Base64.Base64EncodePipeType
Base64EncodePipe(ostream)

Return a new write-only I/O stream, which converts any bytes written to it into base64-encoded ASCII bytes written toostream. Callingclose on theBase64EncodePipe stream is necessary to complete the encoding (but does not closeostream).

Examples

julia> io = IOBuffer();julia> iob64_encode = Base64EncodePipe(io);julia> write(iob64_encode, "Hello!")6julia> close(iob64_encode);julia> str = String(take!(io))"SGVsbG8h"julia> String(base64decode(str))"Hello!"
Base64.base64encodeFunction
base64encode(writefunc, args...; context=nothing)base64encode(args...; context=nothing)

Given awrite-like functionwritefunc, which takes an I/O stream as its first argument,base64encode(writefunc, args...) callswritefunc to writeargs... to a base64-encoded string, and returns the string.base64encode(args...) is equivalent tobase64encode(write, args...): it converts its arguments into bytes using the standardwrite functions and returns the base64-encoded string.

The optional keyword argumentcontext can be set to:key=>value pair or anIO orIOContext object whose attributes are used for the I/O stream passed towritefunc orwrite.

See alsobase64decode.

Base64.Base64DecodePipeType
Base64DecodePipe(istream)

Return a new read-only I/O stream, which decodes base64-encoded data read fromistream.

Examples

julia> io = IOBuffer();julia> iob64_decode = Base64DecodePipe(io);julia> write(io, "SGVsbG8h")8julia> seekstart(io);julia> String(read(iob64_decode))"Hello!"
Base64.base64decodeFunction
base64decode(string)

Decode the base64-encodedstring and returns aVector{UInt8} of the decoded bytes.

See alsobase64encode.

Examples

julia> b = base64decode("SGVsbG8h")6-element Vector{UInt8}: 0x48 0x65 0x6c 0x6c 0x6f 0x21julia> String(b)"Hello!"
Base64.stringmimeFunction
stringmime(mime, x; context=nothing)

Return anAbstractString containing the representation ofx in the requestedmime type. This is similar torepr(mime, x) except that binary data is base64-encoded as an ASCII string.

The optional keyword argumentcontext can be set to:key=>value pair or anIO orIOContext object whose attributes are used for the I/O stream passed toshow.

Settings


This document was generated withDocumenter.jl version 1.8.0 onWednesday 9 July 2025. Using Julia version 1.11.6.


[8]ページ先頭

©2009-2025 Movatter.jp