• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / #37539

pending completion
#37539

push

local

web-flow
add devdocs how to profile package precompilation with tracy (#49784)

1 of 1 new or added line in 1 file covered. (100.0%)

72624 of 83590 relevant lines covered (86.88%)

35576540.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/stdlib/Base64/src/Base64.jl
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2

3
"""
4
    Base64
5

6
Functionality for [base64 encoding and decoding](https://en.wikipedia.org/wiki/Base64),
7
a method to represent binary data using text, common on the web.
8
"""
9
module Base64
10

11
using Base: require_one_based_indexing
12

13
export
14
    Base64EncodePipe,
15
    base64encode,
16
    Base64DecodePipe,
17
    base64decode,
18
    stringmime
19

20
# Base64EncodePipe is a pipe-like IO object, which converts into base64 data
21
# sent to a stream. (You must close the pipe to complete the encode, separate
22
# from closing the target stream).  We also have a function base64encode(f,
23
# args...) which works like sprint except that it produces base64-encoded data,
24
# along with base64encode(args...)  which is equivalent to base64encode(write,
25
# args...), to return base64 strings.  A Base64DecodePipe object can be used to
26
# decode base64-encoded data read from a stream , while function base64decode is
27
# useful for decoding strings
28

29
include("buffer.jl")
30
include("encode.jl")
31
include("decode.jl")
32

33
"""
34
    stringmime(mime, x; context=nothing)
35

36
Return an `AbstractString` containing the representation of `x` in the
37
requested `mime` type. This is similar to [`repr(mime, x)`](@ref) except
38
that binary data is base64-encoded as an ASCII string.
39

40
The optional keyword argument `context` can be set to `:key=>value` pair
41
or an `IO` or [`IOContext`](@ref) object whose attributes are used for the I/O
42
stream passed to [`show`](@ref).
43
"""
44
stringmime(m::MIME, x; context=nothing) = istextmime(m) ? Base.Multimedia._textrepr(m, x, context) : _binstringmime(m, x, context)
2✔
45
stringmime(m::AbstractString, x; context=nothing) = stringmime(MIME(m), x; context=context)
2✔
46

47
_binstringmime(m::MIME, x, context) = Base64.base64encode(show, m, x; context=context)
×
48
_binstringmime(m::MIME, x::Vector{UInt8}, context) = Base64.base64encode(write, x; context=context)
×
49

50
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc