🎨 Reliable-id can be 2
This commit is contained in:
parent
bdcb7faabe
commit
60fe546d31
4 changed files with 19 additions and 4 deletions
|
@ -57,7 +57,7 @@ export default function saveResponse(
|
|||
//Return file reader
|
||||
//TODO: need to automatically delete file once it is no longer used
|
||||
//TODO: need to provide methods to seek through file
|
||||
const stream = fs.createReadStream(tempFileName, { encoding: 'binary' });
|
||||
const stream = fs.createReadStream(tempFileName, { encoding: 'binary' }); //TODO: we may need to remove encoding since mentioning encoding automatically switches to string format
|
||||
return resolve(stream);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ interface ISolid {
|
|||
/** The URL where the files from this torrent are stored, in the format `http://cdn-patch.swtor.com/patch/${product}/${product}_${from}to${to}/` */
|
||||
reliable: string;
|
||||
/** Always '0' or '1' */
|
||||
'reliable-id': '0' | '1';
|
||||
'reliable-id': '0' | '1' | '2';
|
||||
/** Contains further information about this torrent, including the list of files. */
|
||||
info: ISolidFileInfo;
|
||||
}
|
||||
|
|
15
src/ssn/streams/getFileFromDisks.ts
Normal file
15
src/ssn/streams/getFileFromDisks.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import * as stream from 'stream';
|
||||
|
||||
interface IGetFileFromDisksOptions {
|
||||
/** Number of the disk where the local file header starts */
|
||||
diskStart: number;
|
||||
/** Offset into the start of the disk where the local file header starts. */
|
||||
offset: number;
|
||||
/** Length of the stored file (compressed size + optional 12 byte encryption header), but excluding the length of the local file header. */
|
||||
storedSize: number;
|
||||
}
|
||||
|
||||
/** Takes a list of ReadableStreams (the disks), as well as the offset and length, and returns a stream for just one file. */
|
||||
export default function getFileFromDisks(disks: stream.Readable[], { diskStart, offset, storedSize }: IGetFileFromDisksOptions) {
|
||||
//...
|
||||
}
|
|
@ -17,8 +17,8 @@ export default function verifySolidpkg(file: ISolid, { product, from, to }: {pro
|
|||
if (file.reliable !== `http://cdn-patch.swtor.com/patch/${product}/${product}_${from}to${to}/`) {
|
||||
throw new Error(`Expected reliable URL but it was "${file.reliable}".`);
|
||||
}
|
||||
if (file['reliable-id'] !== '0' && file['reliable-id'] !== '1') {
|
||||
throw new Error(`Expected reliable-id to be "0" or "1" but it was "${file['reliable-id']}".`);
|
||||
if (!(['0', '1', '2']).includes(file['reliable-id'])) {
|
||||
throw new Error(`Expected reliable-id to be "0", "1" or "2" but it was "${file['reliable-id']}".`);
|
||||
}
|
||||
|
||||
if (file.info === undefined) {
|
||||
|
|
Loading…
Reference in a new issue