1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v.embed_file: add .to_string() and .to_bytes() utility methods

This commit is contained in:
Delyan Angelov
2021-03-20 09:30:38 +02:00
parent e3c0f305b2
commit a6ddd24f5c
2 changed files with 18 additions and 4 deletions

View File

@@ -3558,12 +3558,10 @@ Full list of builtin options:
#### $embed_file
```v ignore
module main
import os
fn main() {
embedded_file := $embed_file('v.png')
mut fw := os.create('exported.png') or { panic(err.msg) }
fw.write_bytes(embedded_file.data(), embedded_file.len)
fw.close()
os.write_file('exported.png', embedded_file.to_string()) ?
}
```