✔ Allow for 128 KiB piece length
This commit is contained in:
parent
c4b7934013
commit
d276d09634
2 changed files with 5 additions and 5 deletions
|
@ -8,8 +8,8 @@ interface ISolidFile {
|
|||
interface ISolidFileInfo {
|
||||
/** List of files that are part of this torrent. */
|
||||
files: ISolidFile[];
|
||||
/** Length of one piece in bytes, i.e. 64 KiB, 256 KiB, 512 KiB, 1 MiB, 2MiB or 4 MiB */
|
||||
'piece length': 65536 | 262144| 524288 | 1048576| 2097152| 4194304;
|
||||
/** Length of one piece in bytes, i.e. 64 KiB, 128 KiB, 256 KiB, 512 KiB, 1 MiB, 2MiB or 4 MiB */
|
||||
'piece length': 65536 | 131072 | 262144| 524288 | 1048576| 2097152| 4194304;
|
||||
/** Concatenated SHA1 hashes of all pieces, where each hash is 20 bytes long. */
|
||||
pieces: string;
|
||||
/** Whether the torrent is private, always 0. */
|
||||
|
|
|
@ -58,9 +58,9 @@ export default function verifySolidpkg(file: ISolid, { product, from, to }: {pro
|
|||
}
|
||||
}
|
||||
|
||||
//64 KiB, 256 KiB, 512 KiB, 1 MiB, 2 MiB, 4 MiB
|
||||
if (!([0x1_0000, 0x4_0000, 0x8_0000, 0x10_0000, 0x20_0000, 0x40_0000]).includes(file.info['piece length'])) {
|
||||
throw new Error(`Expected piece length to be "65536", "262144", 524288", "1048576", "2097152" or "4194304" but it was "${file.info['piece length']}".`);
|
||||
//64 KiB, 128 KiB, 256 KiB, 512 KiB, 1 MiB, 2 MiB, 4 MiB
|
||||
if (!([0x1_0000, 0x2_0000, 0x4_0000, 0x8_0000, 0x10_0000, 0x20_0000, 0x40_0000]).includes(file.info['piece length'])) {
|
||||
throw new Error(`Expected piece length to be "65536", "131072", 262144", 524288", "1048576", "2097152" or "4194304" but it was "${file.info['piece length']}".`);
|
||||
}
|
||||
if (typeof file.info.pieces !== 'string') {
|
||||
throw new Error(`Expected pieces to be a string but it was "${file.info.pieces}".`);
|
||||
|
|
Loading…
Reference in a new issue