From 3bb970b76b0cc9459cc97305b445f045f1828a46 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Fri, 22 Jun 2018 17:21:14 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Fix=20bencode=20parser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interfaces/ISolidFile.ts | 4 +++- src/ssn/bencodeParser.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/interfaces/ISolidFile.ts b/src/interfaces/ISolidFile.ts index 5416d20..d364051 100644 --- a/src/interfaces/ISolidFile.ts +++ b/src/interfaces/ISolidFile.ts @@ -1,5 +1,7 @@ interface ISolidFile { - //TODO + //TODO: show length + /** File name of this file. */ + path: [string]; } interface ISolidFileInfo { diff --git a/src/ssn/bencodeParser.ts b/src/ssn/bencodeParser.ts index 0ea91cf..223377c 100644 --- a/src/ssn/bencodeParser.ts +++ b/src/ssn/bencodeParser.ts @@ -13,7 +13,7 @@ function bpParse(dv: DataView, posIn: number = 0): { obj: any, pos: number } { const header = dv.getUint8(pos); pos += 1; switch (header) { case 0x64: { //'d' - dictionary (key-value object) - obj = []; + obj = {}; do { //read key const out1 = bpParse(dv, pos);