Skip to content

Instantly share code, notes, and snippets.

@andrewosh
andrewosh / index.js
Last active March 11, 2021 06:57
Hyperbee Pouch Example
const ram = require('random-access-memory')
const hypercore = require('hypercore')
const HyperBee = require('hyperbee')
const HyperBeeDown = require('hyperbeedown')
const PouchDB = require('pouchdb')
start()
async function start () {
const core = hypercore(ram)
@andrewosh
andrewosh / README.md
Created May 11, 2020 02:44
A smal,l end-to-end example of using Hyperdrive/Hyperswarm to replicate a drive

Note: To keep this even smaller, we're using a small helper module called the hyperswarm replicator, which wraps a few Hyperswarm setup details.

@andrewosh
andrewosh / split-drive.js
Created July 29, 2019 09:39
Split hyperdrive content and metadata
```js
const store = corestore(path => {
if (path.indexOf('default') === -1) return raf(`${contentDest}/${path}`)
return raf(`${metadataDest}/${path}`)
})
const drive = hyperdrive(store)
```
@andrewosh
andrewosh / debug.log
Created April 20, 2018 00:11
NPM debug log
0 info it worked if it ends with ok
1 verbose cli [ '/home/andrewosh/.nvm/versions/node/v9.3.0/bin/node',
1 verbose cli '/home/andrewosh/.nvm/versions/node/v9.3.0/bin/npm',
1 verbose cli 'i',
1 verbose cli '-g',
1 verbose cli 'protocol-buffers' ]
2 info using npm@5.5.1
3 info using node@v9.3.0
4 verbose npm-session 02acbfc265a4bdf4
5 silly install loadCurrentTree
### Keybase proof
I hereby claim:
* I am andrewosh on github.
* I am andrewosh (https://keybase.io/andrewosh) on keybase.
* I have a public key whose fingerprint is BBFD E0F7 7359 B5F6 9190 A8FB 7CBC DD51 0920 AC03
To claim this, I am signing this object:
1 [create] check_nlink() - nlink 0 instead of 1
2 [create+unlink] test_create_unlink() - write: No such file or directory
3 [mknod] check_nlink() - nlink 0 instead of 1
4 [symlink] check_nlink() - nlink 0 instead of 1
5 [link] check_nlink() - nlink 0 instead of 1
6 [link-unlink-link] check_nlink() - nlink 0 instead of 1
7 [mkfifo] test_mkfifo() - mkfifo: Function not implemented
8 [mkdir] check_nlink() - nlink 0 instead of 2
8 [mkdir] check_dir_contents() - missing entry <.>
8 [mkdir] check_dir_contents() - missing entry <..>
### Keybase proof
I hereby claim:
* I am andrewosh on github.
* I am andrewosh (https://keybase.io/andrewosh) on keybase.
* I have a public key whose fingerprint is 1DA8 A91B D48B 043B 7A87 0A88 A6CA 39D1 CD8E 07CA
To claim this, I am signing this object:
var memdb = require('memdb')
var crypto = require('crypto')
var hyperdrive = require('hyperdrive')
var drive = hyperdrive(memdb())
var archive = drive.createArchive(crypto.randomBytes(32).toString('hex'), { live: true })
archive.list({ live: false }, function (err, entries) {
console.log('err:', err)
console.log('entries:', entries)
var memdb = require('memdb')
var crypto = require('crypto')
var hyperdrive = require('hyperdrive')
var drive = hyperdrive(memdb())
var archive = drive.createArchive('21db26992a79966fc3336a711122ba160910cc6ce24bd6552cb21949d6c9d1d5', { live: true })
console.log('key:', archive.key.toString('hex'))
archive.list(function (err, entries) {
console.log('err:', err)
console.log('entries:', entries)