Skip to content

Commit 3c4d504

Browse files
authored
Improve FileSystem documentation (#218)
* Mentioned filesystems and paths in README * Improved filesystems documentation
1 parent e421c04 commit 3c4d504

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@ The library also provides interfaces representing data sources and destinations
2121

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

24+
Also, there's an experimental filesystem support provided by `kotlinx.io.files` package.
25+
The package includes `FileSystem` interface and its implementation - `SystemFileSystem`.
26+
27+
`FileSystem` provides basic operations for working with files and directories.
28+
29+
File and directory paths are represented by yet another class provided by the package - `Path`.
30+
2431
There are two `kotlinx-io` modules:
2532
- [kotlinx-io-bytestring](./bytestring) - provides `ByteString`.
26-
- [kotlinx-io-core](./core) - provides IO primitives (`Buffer`, `Source`, `Sink`), depends on `kotlinx-io-bytestring`.
33+
- [kotlinx-io-core](./core) - provides IO primitives (`Buffer`, `Source`, `Sink`), filesystems support, depends on `kotlinx-io-bytestring`.
2734

2835
## Using in your projects
2936

core/common/src/files/FileSystem.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ import kotlinx.io.RawSink
1010
import kotlinx.io.RawSource
1111

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

140148
/**
141-
* Represents information about a file or directory obtainable from a filesystem.
149+
* Represents information about a file or directory obtainable from a filesystem like
150+
* a type of filesystem node (is it a directory or a file?), its size, and so on.
142151
*/
143152
public class FileMetadata(
144153
/**

0 commit comments

Comments
 (0)