🚑 Fix bencode parser
This commit is contained in:
parent
f578b194ac
commit
3bb970b76b
2 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
||||||
interface ISolidFile {
|
interface ISolidFile {
|
||||||
//TODO
|
//TODO: show length
|
||||||
|
/** File name of this file. */
|
||||||
|
path: [string];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ISolidFileInfo {
|
interface ISolidFileInfo {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue