fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 58: Extract file content to a string
Idiom # 58: Extract file content to a string
See
programming-idioms.org
:
Code
String.type.from_bytes (io.file.read.read_all path)
What are effects?
Running Example
ex58 is path := "path/to/file" # type parameter used by the io.file effects to # distinguish different files some_type. x := io.file.use some_type (array u8) path io.file.mode.read (()->(io.file.open some_type).read) match x content array => yak (String.type.from_bytes content) # logic in case of success err error => say err # error handling logic
What are effects?
last changed: 2024-07-01
next: Idiom # 59: Write to standard error stream