From 590dc39f8468471a947f4afa3eb4cb401c16fbfe Mon Sep 17 00:00:00 2001 From: C-3PO Date: Sun, 24 Jun 2018 01:37:10 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Add=20debug=20output=20to=20trac?= =?UTF-8?q?e=20zlib=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interfaces/ISolidFile.ts | 2 +- src/ssn/extractFile.ts | 1 + src/ssn/verifySolidpkg.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/interfaces/ISolidFile.ts b/src/interfaces/ISolidFile.ts index 0eb9cf8..fe6fbe8 100644 --- a/src/interfaces/ISolidFile.ts +++ b/src/interfaces/ISolidFile.ts @@ -10,7 +10,7 @@ interface ISolidFileInfo { files: ISolidFile[]; /** Length of one piece in bytes, e.g. 65536 for 64 KiB, and 4194304 for 4 MiB. */ 'piece length': 65536 | 4194304; - /** Concatenated hashes of all pieces. */ + /** Concatenated SHA1 hashes of all pieces, where each hash is 20 bytes long. */ pieces: string; /** Whether the torrent is private, always 0. */ private: 0 | 1; diff --git a/src/ssn/extractFile.ts b/src/ssn/extractFile.ts index 021227f..ec7f7e4 100644 --- a/src/ssn/extractFile.ts +++ b/src/ssn/extractFile.ts @@ -31,6 +31,7 @@ export default async function extractFile(file: ISsnFileEntry, dvArray: DataView //Uncompress file const uncompressedBuffer: Buffer = await new Promise((resolve, reject) => { + console.log(new Uint8Array(dvFinal.buffer)); zlib.inflateRaw(dvFinal, (error, result) => { if (error !== null) { return reject(error); diff --git a/src/ssn/verifySolidpkg.ts b/src/ssn/verifySolidpkg.ts index d2ae425..3006beb 100644 --- a/src/ssn/verifySolidpkg.ts +++ b/src/ssn/verifySolidpkg.ts @@ -1,6 +1,6 @@ import ISolid from '../interfaces/ISolidFile'; -/** Verifies metafile.solid for correctness. */ +/** Verifies metafile.solid for correctness. See specification at . */ export default function verifySolidpkg(file: ISolid, { product, from, to }: {product: string, from: number, to: number}) { if (typeof file['creation date'] !== 'number') { throw new Error(`Expected creation date to be a number but it was "${file['creation date']}".`);