Skip to content

Commit

Permalink
hotfix vfs function rename
Browse files Browse the repository at this point in the history
  • Loading branch information
barraguda committed Jan 17, 2024
1 parent f4b8228 commit 52c37ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/apis/vfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ file.write(&buffer)?;
```rust
/// Write buffer to file at current position, overwriting any existing data.
let buffer = b"World!";
file.write_at(&buffer)?;
file.write_all(&buffer)?;
```

#### Read at position
Expand Down
7 changes: 5 additions & 2 deletions src/cookbook/file_transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ First, initialize a new project with `kit new file_transfer`
Here's a clean template so you have a complete fresh start:

This guide will use the following `nectar_process_lib` version in `Cargo.toml` for this app:

```
nectar_process_lib = { git = "ssh://[email protected]/uqbar-dao/process_lib.git", rev = "64d2856" }
```
Expand Down Expand Up @@ -396,7 +397,7 @@ This makes adding more features later on very simple.
Now, the actual worker.
Add this bit by bit:

First, because when you spawn your worker you give it `our_capabilities()` (i.e. it has the same capabilities as the parent process), the worker will have the ability to message both `"net:sys:nectar"` and `"vfs:sys:nectar".
First, because when you spawn your worker you give it `our_capabilities()` (i.e. it has the same capabilities as the parent process), the worker will have the ability to message both `"net:sys:nectar"` and `"vfs:sys:nectar"`.
As it's also within the same package, you can simply open the `files_dir` without issue.

```rust
Expand Down Expand Up @@ -581,7 +582,7 @@ WorkerRequest::Chunk {
}
};

file.write_at(&bytes)?;
file.write_all(&bytes)?;

// if sender has sent us a size, give a progress update to main transfer!
if let Some(size) = size {
Expand Down Expand Up @@ -1076,9 +1077,11 @@ impl Guest for Component {
There you have it!

Try and run it, you can download a file with the command

```
/m our@file_transfer:file_transfer:template.nec {"Download": {"name": "dawg.jpeg", "target": "buenosaires.nec@file_transfer:file_transfer:template.nec"}}
```

replacing node name and file name!

Stay tuned for additions to this guide, including restarting transfers after rebooting your node or losing connections, and a simple UI!

0 comments on commit 52c37ab

Please sign in to comment.