bend-kit-files Releases (6): 0.3.1.0 0xc022f29d7abb4bf4d2f497d0b5159f5a indexed https://jend.leeeet.dev/files.txt?path=bend-kit-files@0.3.1.0 0.3.0.0 0xb81a9224a089a51162673b096aa917db unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-files@0.3.0.0 0.2.0.0 0x787b5847bdb8fc0dbba2b006d2d13dd9 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-files@0.2.0.0 0.1.1.1 0xbfce8e3c28ef3e7d2baa52370e0804c4 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-files@0.1.1.1 0.1.1.0 0x6c54b2522c2258baf6f58d2b970c3902 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-files@0.1.1.0 0.1.0.0 0x902b9f92801b87d6be0bcd03919d01bb unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-files@0.1.0.0 Definitions (43): Files.path.is_absolute (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.is_absolute) def path.is_absolute(p: String) -> Bool: Files.path.join.rel (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.join.rel) def path.join.rel(bare: Bool, a: String, b: String) -> String: Files.path.join.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.join.if) def path.join.if(abs: Bool, +a: String, b: String) -> String: Files.path.join (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.join) # b when b is absolute; otherwise b under a. def path.join(a: String, +b: String) -> String: Files.path.norm.pop.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.norm.pop.if) def path.norm.pop.if(up: Bool, h: String, t: List<&2, String>) -> List<&2, String>: Files.path.norm.pop (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.norm.pop) # A ".." above the root is dropped; above a relative start it is kept. def path.norm.pop(stack: List<&2, String>, abs: Bool) -> List<&2, String>: Files.path.norm.step (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.norm.step) def path.norm.step( skip: Bool, up: Bool, s: String, stack: List<&2, String>, abs: Bool ) -> List<&2, String>: Files.path.norm.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.norm.go) # The kept segments, last first. def path.norm.go(segs: List<&2, String>, stack: List<&2, String>, +abs: Bool) -> List<&2, String>: Files.path.norm.fin (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.norm.fin) def path.norm.fin(abs: Bool, body: String) -> String: Files.path.normalize (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.normalize) # Drops empty and "." segments and resolves "..", as POSIX normpath does # (RFC 3986 ยง5.2.4 for paths), but always to one leading "/". def path.normalize(+p: String) -> String: Files.path.parent (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.parent) def path.parent(p: String) -> String: Files.path.file_name.fin (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.file_name.fin) def path.file_name.fin(m: Maybe<&2, String>) -> String: Files.path.file_name (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.file_name) # The last segment of the normalized path; "" for "/" and ".". def path.file_name(p: String) -> String: Files.path.extension.fin (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.extension.fin) def path.extension.fin(bare: Bool, ext: String) -> String: Files.path.extension.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.extension.go) def path.extension.go(rev: List<&2, String>) -> String: Files.path.extension (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=path.extension) # The text after the file name's last ".", without the dot. A leading dot # does not start one: ".bashrc" has none. def path.extension(p: String) -> String: Files.FileType (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=FileType) type FileType is Data: Regular{} Directory{} Other{} Files.Info (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=Info) # mtime is whole seconds since the Unix epoch. size and mtime wrap at 2^32. type Info is Data: Info{kind: FileType, size: U32, mtime: U32} Files.list_dir.raw (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=list_dir.raw) # Entry names, NUL-separated, in the order the OS gives them. def list_dir.raw(path: String) -> IO(Result<&1, &1, U32 & String, String>): Files.stat.raw (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=stat.raw) # (kind, size, mtime); kind 0 is a regular file, 1 a directory, 2 other. # Symbolic links are followed. def stat.raw(path: String) -> IO(Result<&1, &1, U32 & String, U32 & U32 & U32>): Files.mkdir (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=mkdir) def mkdir(path: String) -> IO(Result<&1, &1, U32 & String, Unit>): Files.remove (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=remove) # Removes a file or an empty directory. def remove(path: String) -> IO(Result<&1, &1, U32 & String, Unit>): Files.rename (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=rename) def rename(from: String, to: String) -> IO(Result<&1, &1, U32 & String, Unit>): Files.temp_dir (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=temp_dir) # Creates a new, empty, private directory under the system temp dir. def temp_dir() -> IO(Result<&1, &1, U32 & String, String>): Files.read.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=read.words) # A successful zero-length read is EOF (or max = 0). Reads at most 1 MiB # per call; a short read is not necessarily EOF. Errors retain the File. def read.words(file: File, max: U32) -> IO(File & Result<&1, &1, U32 & String, U32 & Array>): Files.size64 (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=size64) # The size of an open file as (hi, lo): hi * 2^32 + lo bytes. Errors retain the File. def size64(file: File) -> IO(File & Result<&1, &1, U32 & String, U32 & U32>): Files.read.words.at (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=read.words.at) # read.words at byte offset hi * 2^32 + lo. The file position does not move. def read.words.at(file: File, hi: U32, lo: U32, max: U32) -> IO(File & Result<&1, &1, U32 & String, U32 & Array>): Files.read_bytes.wrap (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=read_bytes.wrap) def read_bytes.wrap(result: Result<&1, &1, U32 & String, U32 & Array>) -> Result<&1, &1, U32 & String, Bytes.Bytes>: Files.read_bytes.pair (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=read_bytes.pair) def read_bytes.pair(pair: File & Result<&1, &1, U32 & String, U32 & Array>) -> File & Result<&1, &1, U32 & String, Bytes.Bytes>: Files.read_bytes (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=read_bytes) # The existing Bytes layout, without an octet List or String. def read_bytes(file: File, max: U32) -> IO(File & Result<&1, &1, U32 & String, Bytes.Bytes>): Files.write.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=write.words) # Writes the entire buffer or fails. Errors retain the File; writes before # an error are not rolled back. A len beyond the word array fails EINVAL. def write.words(file: File, len: U32, words: Array) -> IO(File & Result<&1, &1, U32 & String, Unit>): Files.write_bytes (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=write_bytes) def write_bytes(file: File, data: Bytes.Bytes) -> IO(File & Result<&1, &1, U32 & String, Unit>): Files.list_dir.fin (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=list_dir.fin) def list_dir.fin(r: Result<&1, &1, U32 & String, String>) -> Result<&1, &1, U32 & String, List<&2, String>>: Files.list_dir (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=list_dir) # Entry names, without "." and "..", sorted. def list_dir(path: String) -> IO(Result<&1, &1, U32 & String, List<&2, String>>): Files.stat.kind (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=stat.kind) def stat.kind(+k: U32) -> FileType: Files.stat.fin (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=stat.fin) def stat.fin(r: Result<&1, &1, U32 & String, U32 & U32 & U32>) -> Result<&1, &1, U32 & String, Info>: Files.stat (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=stat) def stat(path: String) -> IO(Result<&1, &1, U32 & String, Info>): Files.exists (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=exists) def exists(path: String) -> IO(Bool): Files.mkdir_all.dir (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=mkdir_all.dir) def mkdir_all.dir(r: Result<&1, &1, U32 & String, Info>) -> Result<&1, &1, U32 & String, Unit>: Files.mkdir_all.fail (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=mkdir_all.fail) def mkdir_all.fail(exists: Bool, e: U32 & String, k: IO(Result<&1, &1, U32 & String, Unit>)) -> IO(Result<&1, &1, U32 & String, Unit>): Files.mkdir_all.step (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=mkdir_all.step) def mkdir_all.step(r: Result<&1, &1, U32 & String, Unit>, k: IO(Result<&1, &1, U32 & String, Unit>)) -> IO(Result<&1, &1, U32 & String, Unit>): Files.mkdir_all.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=mkdir_all.go) def mkdir_all.go(segs: List<&2, String>, +at: String) -> IO(Result<&1, &1, U32 & String, Unit>): Files.mkdir_all (https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=mkdir_all) # Creates the directory and any missing parents. Succeeds when it is # already a directory; fails if a component is not a directory. def mkdir_all(+path: String) -> IO(Result<&1, &1, U32 & String, Unit>):