Files.load_data(path: String) -> [UInt8]
Load file contents as a byte array.
val bytes = Files.load_data("assets/data.bin")
File I/O, filesystem queries, directory listing, compression, hashing, base64, random.
File I/O, filesystem queries, directory listing, compression, hashing, base64, random. Files.* namespace binds raylib's rcore.c file API; Random.* binds SetRandom*.
Files.load_data(path: String) -> [UInt8]Load file contents as a byte array.
val bytes = Files.load_data("assets/data.bin")
Files.save_data(path: String, data: [UInt8]) -> Bool / export_data_as_code(data, path) -> BoolWrite bytes to file; embed as C source.
Files.save_data("save.bin", bytes)
Files.load_text(path: String) -> String / save_text(path, text) -> BoolText file round-trip.
val config = Files.load_text("config.json")
Files.save_text("out.txt", "hello")
Files.exists(path) -> Bool / directory_exists(path) -> Bool / is_file(path) -> BoolPath-type predicates.
if Files.exists("tests/assets/bounce.wav") { }
Files.is_extension(path, ext: String) -> Bool / extension(path) -> String / basename(path) / stem(path)Extension match + parsing.
val ext = Files.extension("sprite.png") -- ".png"
Files.directory(path) -> String / parent_directory(path) -> String / working_directory() / application_directory()Path parts + process directories.
val cwd = Files.working_directory()
Files.change_directory(path) -> Bool / make_directory(path) -> Int32 / is_valid_name(path) -> Bool / mod_time(path) -> Int64 / length(path) -> Int32Mutations + metadata.
Files.make_directory("saves")
Files.list(path: String) -> FilePathList / list_ex(path, filter, scan_subdirs: Bool) / unload_list(list)Scan directory (flat or recursive, with optional extension filter). Pair with unload_list.
val list = Files.list("tests/assets")
Files.unload_list(list)
Files.compress(data: [UInt8]) -> [UInt8] / decompress(data: [UInt8]) -> [UInt8]DEFLATE compress / decompress.
val packed = Files.compress(bytes)
val unpacked = Files.decompress(packed)
Files.encode_base64(data: [UInt8]) -> String / decode_base64(b64: String) -> [UInt8]Base64 round-trip.
val b64 = Files.encode_base64(bytes)
Files.compute_crc32(data: [UInt8]) -> UInt32CRC32 checksum (ISO 3309 polynomial). Canonical vector: "123456789" → 0xcbf43926.
val crc = Files.compute_crc32(bytes)
Files.compute_md5(data: [UInt8]) -> [UInt8]16-byte MD5 digest (RFC 1321). Canonical vector: "abc" → 900150983cd24fb0d6963f7d28e17f72.
val digest = Files.compute_md5(bytes)
Files.compute_sha1(data: [UInt8]) -> [UInt8]20-byte SHA-1 digest (FIPS 180-1). Canonical vector: "abc" → a9993e364706816aba3e25717850c26c9cd0d89d.
val digest = Files.compute_sha1(bytes)
Random.set_seed(seed: UInt32)Seed the PRNG for reproducible sequences.
Random.set_seed(UInt32(42))
Random.get_value(min, max: Int32) -> Int32Inclusive random integer in [min, max].
val d6 = Random.get_value(Int32(1), Int32(6))
Random.load_sequence(count: UInt32, min: Int32, max: Int32) -> [Int32] / unload_sequence(seq)Generate a non-repeating shuffled sequence (Fisher-Yates). unload_sequence does nothing in Iron because the sequence is garbage-collected.
val deal = Random.load_sequence(UInt32(52), Int32(0), Int32(51))
Files.is_dropped / load_dropped.