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.from_bytes (io.file.read.read_all path)
What are effects?
Running Example
ex58 is path := "path/to/file" lm : mutate is lm.instate_self ()-> x := io.file.use (array u8) lm path io.file.mode.read (()->io.buffered.read_fully lm) match x content array => yak (String.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