Skip to content

Commit 951e511

Browse files
authored
Document getBlobsLength and truncate (#370)
1 parent 45337fc commit 951e511

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ Deletes all the blobs from storage to free up space, similar to how `drive.clear
194194
}
195195
```
196196

197+
#### `await drive.truncate(version, [options] })`
198+
199+
Truncates the Hyperdrive to a previous version (both the file-structure reference and the blobs).
200+
201+
A `blobs: <length>` option can be passed in if you know the corresponding blobs length, but it is recommended to let the method figure it out for you.
202+
197203
#### `await drive.purge()`
198204

199205
Purge both cores (db and blobs) from your storage, completely removing all the drive's data.
@@ -376,6 +382,10 @@ const buffer2 = await blobs.get(entry.value.blob)
376382
[core-range-docs]: https://github.com/holepunchto/hypercore#const-range--coredownloadrange
377383
[store-replicate-docs]: https://github.com/holepunchto/corestore#const-stream--storereplicateoptsorstream
378384

385+
#### `const blobsLength = await drive.getBlobsLength(checkout)`
386+
387+
Returns the length of the Hyperblobs instance at the time of the specified Hyperdrive version (defaults to the current version).
388+
379389
## License
380390

381391
Apache-2.0

0 commit comments

Comments
 (0)