Skip to content

Commit

Permalink
Fix storage docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Jul 6, 2023
1 parent 22b76cc commit 9bf96cc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/jswrap_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,21 +608,22 @@ This means that while `StorageFile` files exist in the same area as those from
`Storage`, they should be read using `Storage.open` (and not `Storage.read`).
```
f = s.open("foobar","w");
f = require("Storage").open("foobar","w");
f.write("Hell");
f.write("o World\n");
f.write("Hello\n");
f.write("World 2\n");
f.write("Hello World 3\n");
// there's no need to call 'close'
// then
f = s.open("foobar","r");
f = require("Storage").open("foobar","r");
f.read(13) // "Hello World\nH"
f.read(13) // "ello\nWorld 2\n"
f.read(13) // "Hello World 3"
f.read(13) // "\n"
f.read(13) // undefined
// or
f = s.open("foobar","r");
f = require("Storage").open("foobar","r");
f.readLine() // "Hello World\n"
f.readLine() // "Hello\n"
f.readLine() // "World 2\n"
Expand Down

0 comments on commit 9bf96cc

Please sign in to comment.