char/avril
(wip) why'd you have to go and make things so complicaaaaated?
git clone https://git.t4t.associates/char/avril
38d7f6c
main
1import * as file from "ext:file/sync.js" ; 2import * as stdio from "ext:stdio/sync.js" ; 3 4import type { DirEntry , FileInfo , OpenOptions } from "avril:std" ; 5export type { DirEntry , FileInfo , OpenOptions } from "avril:std" ; 6export type FileHandle = import ( "avril:std" ). FileHandle ; 7 8export const errors :typeof import ( "avril:std" ). errors = file . errors ; 9export const FileHandle :typeof import ( "avril:std" ). FileHandle = file . FileHandle ; 10export const SeekMode :typeof import ( "avril:std" ). SeekMode = file . SeekMode ; 11 12/** Blocking stdin. Overlapping native reads throw Busy; canceling the async stream also closes this input. Unavailable in the REPL and workers. */ 13export const stdin :Readonly <{ 14read ( buffer :Uint8Array ) :number | null ; 15}> = stdio . stdin ; 16/** Blocking output, ordered with already-submitted stream and console writes. Does not run JS callbacks while waiting. */ 17export const stdout :Readonly <{ 18write ( bytes :Uint8Array ) :number ; 19}> = stdio . stdout ; 20export const stderr :Readonly <{ 21write ( bytes :Uint8Array ) :number ; 22}> = stdio . stderr ; 23 24export const open :( 25path :string | URL , 26options ?:OpenOptions , 27) => FileHandle = file . open ; 28export const create :( path :string | URL ) => FileHandle = file . create ; 29export const stat :( path :string | URL ) => FileInfo = file . stat ; 30export const lstat :( path :string | URL ) => FileInfo = file . lstat ; 31export const readDir :( path :string | URL ) => Iterable < DirEntry > = file . readDir ; 32export const mkdir :( 33path :string | URL , 34options ?:{ mode ?:number }, 35) => void = file . mkdir ; 36export const remove :( 37path :string | URL , 38options ?:{ recursive ?:boolean }, 39) => void = file . remove ; 40/** Requires directory-shaped authority over the source (read/write) and destination (write). Scoped directory renames containing symlinks are not yet implemented. */ 41export const rename :( 42source :string | URL , 43destination :string | URL , 44) => void = file . rename ; 45export const copyFile :( 46source :string | URL , 47destination :string | URL , 48) => void = file . copyFile ; 49/** Stores target text unchanged; requires write at the link and read/write tree authority over its target. Creation on Windows is not yet implemented. */ 50export const symlink :( 51target :string | URL , 52linkPath :string | URL , 53options ?:{ type ?:"file" | "dir" }, 54) => void = file . symlink ; 55/** Reads the link's stored text, not its referent. */ 56export const readLink :( path :string | URL ) => string = file . readLink ; 57export const realPath :( path :string | URL ) => string = file . realPath ; 58/** Changes the file mode bits. Follows links. */ 59export const chmod :( path :string | URL , mode :number ) => void = file . chmod ; 60/** Null keeps that id; 4294967295 is rejected. Follows links. */ 61export const chown :( 62path :string | URL , 63uid :number | null , 64gid :number | null , 65) => void = file . chown ; 66/** Like chown but acts on the link itself. */ 67export const lchown :( 68path :string | URL , 69uid :number | null , 70gid :number | null , 71) => void = file . lchown ; 72/** Times are seconds since the Unix epoch, like Deno and Node; Dates are accepted. Follows links. */ 73export const utime :( 74path :string | URL , 75atime :number | Date , 76mtime :number | Date , 77) => void = file . utime ; 78/** Like utime but acts on the link itself; a trailing slash follows instead. */ 79export const lutime :( 80path :string | URL , 81atime :number | Date , 82mtime :number | Date , 83) => void = file . lutime ; 84/** Requires read and write authority over the source and write over the destination; symlink sources are refused. */ 85export const link :( 86oldpath :string | URL , 87newpath :string | URL , 88) => void = file . link ; 89/** Sets the file size, zero-filling growth. Follows links. */ 90export const truncate :( path :string | URL , length ?:number ) => void = file . truncate ;