Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/okdistribute/hyperdrive-haus
A hyperdrive javascript API for dat.haus
https://github.com/okdistribute/hyperdrive-haus
Last synced: 24 days ago
JSON representation
A hyperdrive javascript API for dat.haus
- Host: GitHub
- URL: https://github.com/okdistribute/hyperdrive-haus
- Owner: okdistribute
- Created: 2016-08-05T14:43:25.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-09T09:56:45.000Z (over 8 years ago)
- Last Synced: 2025-01-03T09:43:03.937Z (28 days ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome-starred - okdistribute/hyperdrive-haus - A hyperdrive javascript API for dat.haus (others)
README
# hyperdrive-haus
A hyperdrive javascript API for dat.haus
[![NPM](https://nodei.co/npm/hyperdrive-haus.png)](https://nodei.co/npm/hyperdrive-haus/)
```js
var haus = require('hyperdrive-haus')
var archive = haus('archive-key-here')archive.list(function (err, files) {
console.log(files) // list of files
})```
## API
### `var archive = haus(archive, opts)`
`archive`: a hyperdrive archive **or** a hex encoded hyperdrive string.
`opts`:
- `url`: the URL for dat.haus, defaults to `http://dat.haus`### `archive.createFileReadStream(entry)`
Creates a read stream of the file with a given file name
Example:
```js
var readStream = archive.createFileReadStream('hello.txt')
readStream.pipe(process.stdout)
```### `archive.list(callback)`
List the files in the archive. Takes an optional callback. Will return a stream if callback not supplied.
```js
var stream = archive.list()
stream.on('data', function (entry) {
console.log(entry)
})
```