Created
September 13, 2017 12:16
-
-
Save sdockray/f65730586135fa310ff5d4e17c25d884 to your computer and use it in GitHub Desktop.
sparse dat metadata wonkiness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Dat = require('dat-node') | |
var messages = require('dat-protocol-buffers'); | |
Dat('bpp', { | |
key: 'c6ea9ce5627140020b15de05ecb054e8d1a354559e4a0b9b2295d22d87de632b', | |
sparse: true, | |
temp: true, | |
}, function (err, dat) { | |
if (err) throw err | |
dat.joinNetwork() | |
dat.archive.metadata.on('download', function(index, data) { | |
if (index > 0) { | |
var block = messages.Node.decode(data) | |
var type = block.value ? 'put' : 'del' | |
console.log(`${index}: ${type} : ${block.path}`) | |
} | |
}) | |
dat.archive.metadata.on('sync', function() { | |
console.log('metadata synced') | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment