# fs

File system access with restrictions & canonical resolution.
This one allows the use of "..", without breaching the workspace.


# Functions

# fs.read(path: string): string

fs.read(path: string): string
  • Reads a file from a given path

# fs.write(path: string, data: string)

fs.write(path: string, data: string)
  • Writes to a file provided by the path

# fs.isfile(path: string): boolean

fs.isfile(path: string): boolean
  • Checks if a filesystem object is a file

# fs.isfolder(path: string): boolean

fs.isfolder(path: string): boolean
  • Checks if a filesystem object is a folder

# fs.listfiles(path: string): string[]

fs.listfiles(path: string): string[]
  • Lists files in the specified path

# fs.makefolder(path: string)

fs.makefolder(path: string)
  • Creates a folder in the specified path
  • This is recursive, allowing it to generate multiple folders

# fs.delfolder(path: string)

fs.delfolder(path: string)
  • Deletes a folder from the specified path

# fs.delfile(path: string)

fs.delfile(path: string)
  • Deletes a file from the specified path

# fs.append(path: string, data: string)

fs.append(path: string, data: string)
  • Appends data onto the specified file

# fs.forward(path: string): string

fs.forward(path: string): string
  • Changes all "\" separators to "/"

# fs.backward(path: string): string

fs.backward(path: string): string
  • Changes all "/" separators to "\"

# fs.join(a: string, b: string): string

fs.join(a: string, b: string): string
  • Joins two paths together

# fs.extname(path: string, replace?: string): string

fs.extname(path: string, replace?: string): string
  • Gets the extension name of a path
  • If provided a replacement, will return the replaced path's extension

# fs.filename(path: string, replace?: string): string

fs.filename(path: string, replace?: string): string
  • Gets the file name of a path
  • If provided a replacement, will return the replaced path's file

# fs.dirname(path: string, replace?: string): string

fs.dirname(path: string, replace?: string): string
  • Gets the directory name of a path
  • If provided a replacement, will return the replaced path's directory

# fs.sanitize(path: string): string

fs.sanitize(path: string): string
  • Removes any oddities in the path, replacing them with "_" instead.