NodeJsFileSystem

object NodeJsFileSystem : FileSystem

Use Node.js APIs to implement the Okio file system interface.

This class needs to make calls to some fs APIs that have multiple competing overloads. To unambiguously select an overload this passes undefined as the target type to some functions.

Functions

Link copied to clipboard
open override fun appendingSink(file: Path, mustExist: Boolean): Sink
Link copied to clipboard
open override fun atomicMove(source: Path, target: Path)
Link copied to clipboard
open override fun canonicalize(path: Path): Path
Link copied to clipboard
open fun copy(source: Path, target: Path)
Link copied to clipboard
fun createDirectories(dir: Path, mustCreate: Boolean)
Link copied to clipboard
open override fun createDirectory(dir: Path, mustCreate: Boolean)
Link copied to clipboard
open override fun createSymlink(source: Path, target: Path)
Link copied to clipboard
open override fun delete(path: Path, mustExist: Boolean)

We don't know if path is a file or a directory, but we don't (yet) have an API to delete either type. Just try each in sequence.

Link copied to clipboard
open fun deleteRecursively(fileOrDirectory: Path, mustExist: Boolean)
Link copied to clipboard
fun exists(path: Path): Boolean
Link copied to clipboard
open override fun list(dir: Path): List<Path>
Link copied to clipboard
open override fun listOrNull(dir: Path): List<Path>?
Link copied to clipboard
open fun listRecursively(dir: Path, followSymlinks: Boolean): Sequence<Path>
Link copied to clipboard
fun metadata(path: Path): FileMetadata
Link copied to clipboard
open override fun metadataOrNull(path: Path): FileMetadata?
Link copied to clipboard
open override fun openReadOnly(file: Path): FileHandle
Link copied to clipboard
open override fun openReadWrite(file: Path, mustCreate: Boolean, mustExist: Boolean): FileHandle
Link copied to clipboard
inline fun <T> read(file: Path, readerAction: BufferedSource.() -> T): T
Link copied to clipboard
open override fun sink(file: Path, mustCreate: Boolean): Sink
Link copied to clipboard
open override fun source(file: Path): Source
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
inline fun <T> write(file: Path, mustCreate: Boolean, writerAction: BufferedSink.() -> T): T