https://github.com/trondpet/hyperdrive-helpers
Helpers for working with hyperdrives
https://github.com/trondpet/hyperdrive-helpers
hyperdrive utils
Last synced: 4 months ago
JSON representation
Helpers for working with hyperdrives
- Host: GitHub
- URL: https://github.com/trondpet/hyperdrive-helpers
- Owner: trondpet
- License: mit
- Created: 2018-10-21T16:01:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T21:17:01.000Z (about 3 years ago)
- Last Synced: 2025-09-24T05:27:15.695Z (7 months ago)
- Topics: hyperdrive, utils
- Language: JavaScript
- Homepage:
- Size: 1020 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# hyperdrive-helpers [](https://travis-ci.com/trondpet/hyperdrive-helpers)
Helpers for working with [hyperdrives](https://github.com/mafintosh/hyperdrive).
## API
All the stuff's `async`.
### openArchive
Opens a hyperdrive and returns a handle to the archive & keys
```
const { openArchive } = require('hyperdrive-helpers')
const { archive, discoveryKey, key } = await openArchive('/myarchive')
```
### addToArchive
Adds a folder w/files to the archive
```
const { openArchive, addToArchive } = require('hyperdrive-helpers')
const { archive } = await openArchive('/myarchive')
await addToArchive(archive, [ '/Users/Dane.Cook/stuff' ])
```
### readArchive
Reads a dir in an archive
```
const { openArchive, readArchive } = require('hyperdrive-helpers')
const { archive } = await openArchive('/myarchive')
const contents = await readArchive(archive, '/Users/Dane.Cook/stuff' )
const { path, isFile, isDirectory, size, atime, ctime, mtime } = contents[0]
```
### removePath
Delete files and/or directories from archive
```
const { openArchive, removePath } = require('hyperdrive-helpers')
const { archive } = await openArchive('/myarchive')
await removePath(archive, ['/dane/cook', '/other/stuff'])
```
### copyToFs
Copy a file from a hyperdrive to the file system
```
const { openArchive, copyToFs } = require('hyperdrive-helpers')
const { archive } = await openArchive('/myarchive')
await copyToFs(archive, '/important-doc.txt', '/Users/Dane.Cook/Downloads')
```