Skip to content

Commit

Permalink
Merge pull request #179 from jurij-jukic/section-2-6
Browse files Browse the repository at this point in the history
Section 2.6. Files
  • Loading branch information
jurij-jukic authored May 10, 2024
2 parents 731ed49 + c9c50c7 commit e15c099
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
## Virtual File System (VFS)

The primary way to access files within your node is through the [VFS API](./apis/vfs.md).
The VFS API follows std::fs closely, adding some capabilities checks on paths and some combinatory actions.
The VFS API follows [std::fs](https://doc.rust-lang.org/std/fs/index.html) closely, while also adding some capabilities checks on paths.

VFS files exist in the "/vfs" folder within your home node, and files are grouped by `package_id`.
VFS files exist in the "/vfs" folder within your home node, and files are grouped by [`package_id`](https://docs.rs/kinode_process_lib/latest/kinode_process_lib/struct.PackageId.html).
For example, part of the VFS might look like:

```text
Expand Down Expand Up @@ -33,7 +33,7 @@ For example, part of the VFS might look like:

## Usage

To access files in the VFS, you need to create or open a [drive](./apis/vfs.md#drives), this can be done with the function `create_drive` from the [standard library](./process_stdlib/overview.md):
To access files in the VFS, you need to create or open a [drive](./apis/vfs.md#drives), this can be done with the function [`create_drive`](https://docs.rs/kinode_process_lib/latest/kinode_process_lib/vfs/file/fn.create_drive.html) from the [standard library](./process_stdlib/overview.md):

```rust
let drive_path: String = create_drive(our.package_id(), "drive_name")?;
Expand All @@ -43,8 +43,3 @@ let test_file = create_file(&format("{}/test.txt", &drive_path))?;
let text = b"hello world!"
file.write(&text)?;
```

## References

- [VFS API](./apis/vfs.md)
- [std::fs API](https://doc.rust-lang.org/std/fs/index.html)

0 comments on commit e15c099

Please sign in to comment.