Skip to content

Improve FileSystem documentation #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ The library also provides interfaces representing data sources and destinations

In addition to `Buffer`, the library provides an immutable sequence of bytes - `ByteString`.

Also, there's an experimental filesystem support provided by `kotlinx.io.files` package.
The package includes `FileSystem` interface and its implementation - `SystemFileSystem`.

`FileSystem` provides basic operations for working with files and directories.

File and directory paths are represented by yet another class provided by the package - `Path`.

There are two `kotlinx-io` modules:
- [kotlinx-io-bytestring](./bytestring) - provides `ByteString`.
- [kotlinx-io-core](./core) - provides IO primitives (`Buffer`, `Source`, `Sink`), depends on `kotlinx-io-bytestring`.
- [kotlinx-io-core](./core) - provides IO primitives (`Buffer`, `Source`, `Sink`), filesystems support, depends on `kotlinx-io-bytestring`.

## Using in your projects

Expand Down
13 changes: 11 additions & 2 deletions core/common/src/files/FileSystem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ import kotlinx.io.RawSink
import kotlinx.io.RawSource

/**
* An interface providing basic operations on a filesystem.
* An interface providing basic operations on a filesystem, such as reading and writing files,
* creating directories, gathering file metadata and so on.
*
* Default implementation of this interface is [SystemFileSystem]. It provides access to files and directories
* on disk.
*
* The interface is sealed until API stabilization, but in the future it will allow
* creating custom filesystems that could be used as mocks for testing or provide
* access to some network resources and allow working with them as with regular files, for example.
*
* **This API is unstable and subject to change.**
*/
Expand Down Expand Up @@ -138,7 +146,8 @@ public expect val SystemFileSystem: FileSystem
public expect val SystemTemporaryDirectory: Path

/**
* Represents information about a file or directory obtainable from a filesystem.
* Represents information about a file or directory obtainable from a filesystem like
* a type of filesystem node (is it a directory or a file?), its size, and so on.
*/
public class FileMetadata(
/**
Expand Down