Ende.writeTextFile

function ยท requires --allow-read, --allow-write

function Ende.writeTextFile(path: string | URL, data: string | ReadableStream<string>, options?: WriteFileOptions): Promise<void>

Write string data to the given path, by default creating a new file if needed, else overwriting.

await Ende.writeTextFile("hello1.txt", "Hello world\n");  // overwrite "hello1.txt" or create it

The data is written to the file and the file is closed, but this does not guarantee that the contents have been flushed from the operating system's buffers to the physical storage device. If you need such a durability guarantee (for example before signalling that a write has been committed), open the file with Ende.open and call Ende.FsFile.sync before closing it.

Requires allow-write permission, and allow-read if options.create is false.