# hyperdrive-helpers

> Helper utils for working with hyperdrives

Latest version **0.0.8** (published 2021-05-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install hyperdrive-helpers
pnpm add hyperdrive-helpers
yarn add hyperdrive-helpers
bun add hyperdrive-helpers
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2021-05-10 |
| First published | 2018-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 16 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Trond Pettersen |
| Maintainers | trondpet |
| Keywords | hyperdrive, utils, helpers |

## Links

- npm: https://www.npmjs.com/package/hyperdrive-helpers
- Repository: https://github.com/trondpet/hyperdrive-helpers
- Homepage: https://github.com/trondpet/hyperdrive-helpers#readme
- Issues: https://github.com/trondpet/hyperdrive-helpers/issues
- npm.io page: https://npm.io/package/hyperdrive-helpers

## Dependencies (5)

- [pino](https://npm.io/package/pino.md) ^6.11.1
- [p-map](https://npm.io/package/p-map.md) ^4.0.0
- [p-filter](https://npm.io/package/p-filter.md) ^2.1.0
- [hyperdrive](https://npm.io/package/hyperdrive.md) ^10.20.0
- [@hyperswarm/network](https://npm.io/package/@hyperswarm/network.md) 2.1.0

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.0.8 (latest) — 2021-05-10
- 0.0.7 — 2021-02-16
- 0.0.5 — 2019-02-09
- 0.0.4 — 2018-11-16
- 0.0.3 — 2018-11-10
- 0.0.2 — 2018-11-06
- 0.0.1 — 2018-10-28

## README

# hyperdrive-helpers [![Build Status](https://travis-ci.com/trondpet/hyperdrive-helpers.svg?branch=master)](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')

```

---
_Source: https://npm.io/package/hyperdrive-helpers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
