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

appendingSink
Link copied to clipboard
open override fun appendingSink(file: Path, mustExist: Boolean): Sink
atomicMove
Link copied to clipboard
open override fun atomicMove(source: Path, target: Path)
canonicalize
Link copied to clipboard
open override fun canonicalize(path: Path): Path
copy
Link copied to clipboard
open fun copy(source: Path, target: Path)
createDirectories
Link copied to clipboard
fun createDirectories(dir: Path, mustCreate: Boolean)
createDirectory
Link copied to clipboard
open override fun createDirectory(dir: Path, mustCreate: Boolean)
createSymlink
Link copied to clipboard
open override fun createSymlink(source: Path, target: Path)
delete
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.

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