hyperdrive-helpers

0.0.8 • Public • Published

hyperdrive-helpers Build Status

Helpers for working with hyperdrives.

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')

Package Sidebar

Install

npm i hyperdrive-helpers

Weekly Downloads

0

Version

0.0.8

License

MIT

Unpacked Size

16.4 kB

Total Files

13

Last publish

Collaborators

  • trondpet