Skip to content

Commit

Permalink
Document getBlobsLength and truncate (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
HDegroote authored Sep 6, 2024
1 parent 45337fc commit 951e511
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ Deletes all the blobs from storage to free up space, similar to how `drive.clear
}
```

#### `await drive.truncate(version, [options] })`

Truncates the Hyperdrive to a previous version (both the file-structure reference and the blobs).

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.

#### `await drive.purge()`

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

#### `const blobsLength = await drive.getBlobsLength(checkout)`

Returns the length of the Hyperblobs instance at the time of the specified Hyperdrive version (defaults to the current version).

## License

Apache-2.0

0 comments on commit 951e511

Please sign in to comment.