FileSystem is an abstract file system API, LocalFileSystem is an implementation accessing files on the local machine. SubTreeFileSystem is an implementation that delegates to another implementation after prepending a fixed base path

Factory

The $create() factory methods instantiate the FileSystem object and take the following arguments, depending on the subclass:

  • no argument is needed for instantiating a LocalFileSystem

  • base_path and base_fs for instantiating a SubTreeFileSystem

Methods

  • $GetFileInfo(x): x may be a FileSelector or a character vector of paths. Returns a list of FileInfo

  • $CreateDir(path, recursive = TRUE): Create a directory and subdirectories.

  • $DeleteDir(path): Delete a directory and its contents, recursively.

  • $DeleteDirContents(path): Delete a directory's contents, recursively. Like $DeleteDir(), but doesn't delete the directory itself. Passing an empty path ("") will wipe the entire filesystem tree.

  • $DeleteFile(path) : Delete a file.

  • $DeleteFiles(paths) : Delete many files. The default implementation issues individual delete operations in sequence.

  • $Move(src, dest): Move / rename a file or directory. If the destination exists: if it is a non-empty directory, an error is returned otherwise, if it has the same type as the source, it is replaced otherwise, behavior is unspecified (implementation-dependent).

  • $CopyFile(src, dest): Copy a file. If the destination exists and is a directory, an error is returned. Otherwise, it is replaced.

  • $OpenInputStream(path): Open an input stream for sequential reading.

  • $OpenInputFile(path): Open an input file for random access reading.

  • $OpenOutputStream(path): Open an output stream for sequential writing.

  • $OpenAppendStream(path): Open an output stream for appending.