🚑 Fix bencode parser

This commit is contained in:
C-3PO 2018-06-22 17:21:14 +02:00
parent f578b194ac
commit 3bb970b76b
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
2 changed files with 4 additions and 2 deletions

View file

@ -1,5 +1,7 @@
interface ISolidFile { interface ISolidFile {
//TODO //TODO: show length
/** File name of this file. */
path: [string];
} }
interface ISolidFileInfo { interface ISolidFileInfo {

View file

@ -13,7 +13,7 @@ function bpParse(dv: DataView, posIn: number = 0): { obj: any, pos: number } {
const header = dv.getUint8(pos); pos += 1; const header = dv.getUint8(pos); pos += 1;
switch (header) { switch (header) {
case 0x64: { //'d' - dictionary (key-value object) case 0x64: { //'d' - dictionary (key-value object)
obj = []; obj = {};
do { do {
//read key //read key
const out1 = bpParse(dv, pos); const out1 = bpParse(dv, pos);