Close a file descriptor.
Open a file descriptor for a given pathstd/os/path/path: (s : string) -> path and file mode fmode.
Read the full contents of a file handle.
Read the full contents of a file handles as a string.
Read the contents of a file handle to a channel as string fragments (of about the chunk-len (=64 KiB)).
Emits a final empty string on end-of-file.
Correctly handles partial utf-8 sequences.
Read the contents of a file handle to a channel in chunks of chunk-len (=64 KiB) when possible.
Emits a final empty bytesstd/core/types/bytes: V on end-of-file.
Note: do not convert byte chunks to a string directly since the may start/end with a partial
utf-8 sequence – use fd-read-text-to-channelstd/async/os/file/fd-read-text-to-channel: (fd : fd, ch : channel<string>, chunk-len : ? int) -> <async,exn,ndet> () instead in such case.
The mode that a (non-seeking) file is opened in.
Append writes to the end of the file; creates the file if it does not yet exist (“a”).
Open for reading, fails if the file does not exist (“r”).
Open for reading and writing; truncates an existing file, or creates the file if it does not yet exist (“w+”).
Open for writing; truncates an existing file, or creates the file if it does not yet exist (“w”).
Automatically generated. Tests for the Append constructor of the filemodestd/async/os/file/filemode: V type.
Automatically generated. Tests for the Readstd/async/os/file/Read: filemode constructor of the filemodestd/async/os/file/filemode: V type.
Automatically generated. Tests for the ReadWritestd/async/os/file/ReadWrite: filemode constructor of the filemodestd/async/os/file/filemode: V type.
Automatically generated. Tests for the Writestd/async/os/file/Write: filemode constructor of the filemodestd/async/os/file/filemode: V type.
Open a file descriptor for a given pathstd/os/path/path: (s : string) -> path and file mode fmode and pass it to action.
Closes the file descriptor when action returns or finalizes.
Read the full contents of a file.
Emit the full contents of a file to a string channel.
Tries to read in chunks of chunk-len (=-1).
Emit the full contents of a file to a bytes channel.
Tries to read in chunks of chunk-len (=-1).
Asynchronous file operations.
Currently, this is only supported for the C (with libuv) and NodeJS (
jsnode) targets.