Skip to content

Instantly share code, notes, and snippets.

@andrewosh
andrewosh / README.md
Created May 11, 2020
A smal,l end-to-end example of using Hyperdrive/Hyperswarm to replicate a drive
View README.md

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 Jul 29, 2019
Split hyperdrive content and metadata
View split-drive.js
```js
const store = corestore(path => {
if (path.indexOf('default') === -1) return raf(`${contentDest}/${path}`)
return raf(`${metadataDest}/${path}`)
})
const drive = hyperdrive(store)
```
View 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
View gist:9b7f97ea086ef8b4821ae6decc1e2bd1
### 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:
View gist:10cf55625cde733782fa3c1ad4664b42
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 <..>
View gist:f8a2706b2e045d5e197f159c7a123200
### 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:
View gist:1938bfda88403c336673ddc679fdeb6e
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)
View gist:202f7f913eae0ce052904b02b0f0f3f8
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)
You can’t perform that action at this time.