aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorLeRoyce Pearson <leroycepearson@geemili.xyz>2020-03-06 20:17:23 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-05-25 13:48:43 -0400
commit8c8813a5cfa710478614cbb022481f830f199bad (patch)
treea2491993bf2ffca496fdea7c10ea04f151387d2e /lib/std
parentce5b2286f1db3d5a01ce139b450140f21c9d9909 (diff)
downloadzig-8c8813a5cfa710478614cbb022481f830f199bad.tar.gz
zig-8c8813a5cfa710478614cbb022481f830f199bad.zip
Add filesystem base64 decoder
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/fs.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index a006d4ea05..c3e8d69b0d 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -55,6 +55,12 @@ pub const base64_encoder = base64.Base64Encoder.init(
base64.standard_pad_char,
);
+/// Base64, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem.
+pub const base64_decoder = base64.Base64Decoder.init(
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
+ base64.standard_pad_char,
+);
+
/// Whether or not async file system syscalls need a dedicated thread because the operating
/// system does not support non-blocking I/O on the file system.
pub const need_async_thread = std.io.is_async and switch (builtin.os.tag) {