require('buffer')
//var test    = require('tape').test
var bencode = require('./lib.js')
var data    = require('./data.js')
/*var input = new Buffer('w6TDtsO8w58=', 'base64')
console.log(data.binKeyName)
var decoded = bencode.decode(data.binKeyData, 'utf8')
console.log(Buffer.byteLength(Object.keys(decoded.files)))
//t.ok(decoded.files.hasOwnProperty(data.binKeyName))
console.log('binKeyName.length', Buffer.byteLength(data.binKeyName.toString('utf8')))
var x = bencode.decode(bencode.encode(data.binKeyName.toString('utf8')))
console.log(x.length)
console.log(x.toString('utf8'))
var bla = {
    files: {}
}
bla.files[x] =  { complete: 0, downloaded: 10, incomplete: 0 }
console.log(data.binKeyData.toString('utf8'))
console.log(bencode.encode(bla).toString('utf8'))
console.log(bla)*/
var x = {files: { '7�U�ࣚ�K�ϧז����$w': { complete: 0, downloaded: 10, incomplete: 0 } }}
console.log(bencode.encode(x).toString('base64'))

var decoded = bencode.decode(data.binKeyData, 'utf8')
console.log(decoded.files)
