os.write{
path:str,
sep:str,
format:str,
offset:int,
size:int,
r:{seq:int, ss:str},
err:str
}
Writes the file contents to the file paths provided.
Writes r tuples sequentially (sep default is "\n"). Or format:="b", expects ss=hex.
Defaults to writing at offset:=0 bytes into the file.
Defaults to writing the whole file, or else size entries from r.
Check if err is set for any failures.
Examples
testwrite1
import("os")
os.write(path:="testwrite1", r:={seq:int, ss:str}{
[0, "this is a file"],
[1, "with two lines"]
})
┌─────┬────────┬────────┬──────┬─────┐ │ sep │ format │ offset │ size │ err │ ├─────┼────────┼────────┼──────┼─────┤ │ \n │ │ 0 │ 2 │ │ └─────┴────────┴────────┴──────┴─────┘
testwrite1 from 1 line
import("os")
os.write(path:="testwrite1", r:=dee(seq:=0, ss:="this is a file\nwith two lines"))
┌─────┬────────┬────────┬──────┬─────┐ │ sep │ format │ offset │ size │ err │ ├─────┼────────┼────────┼──────┼─────┤ │ \n │ │ 0 │ 1 │ │ └─────┴────────┴────────┴──────┴─────┘