Function read

Source
pub fn read(
    engine: &mut Engine<'_>,
    path: Spanned<EcoString>,
    encoding: Option<Encoding>,
) -> SourceResult<Readable>
Expand description

Reads plain text or data from a file.

By default, the file will be read as UTF-8 and returned as a string.

If you specify {encoding: none}, this returns raw [bytes] instead.

ยงExample

An example for a HTML file: \
#let text = read("example.html")
#raw(text, lang: "html")

Raw bytes:
#read("tiger.jpg", encoding: none)