Add support for patchmanifest files

This commit is contained in:
C-3PO 2018-06-22 13:34:36 +02:00
parent f80e34826c
commit c83c3045bc
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
2 changed files with 24 additions and 4 deletions

View file

@ -2,9 +2,17 @@ import getSolidpkg from './ssn/getSolidpkg';
import readSsnFile from './ssn/readSsnFile'; import readSsnFile from './ssn/readSsnFile';
(async () => { (async () => {
const buffer = await getSolidpkg('assets_swtor_de_de', -1, 0); //Read patchmanifest
console.log(buffer.length, buffer); const patchmanifestBuffer = await getPatchmanifest('assets_swtor_de_de');
console.log(patchmanifestBuffer.length, patchmanifestBuffer);
const fileEntries = readSsnFile(buffer); const patchmanifestFiles = readSsnFile(patchmanifestBuffer);
console.log(fileEntries); console.log(patchmanifestFiles);
//Read solidpkg
const solidpkgBuffer = await getSolidpkg('assets_swtor_de_de', -1, 0);
console.log(solidpkgBuffer.length, solidpkgBuffer);
const solidPkgFiles = readSsnFile(solidpkgBuffer);
console.log(solidPkgFiles);
})(); })();

View file

@ -0,0 +1,12 @@
import getUrlContents from '../getUrlContents';
import { Product } from '../interfaces/ISettings';
import verifyProductName from '../verifyProductName';
export default function getPatchmanifest(product: Product): Promise<Buffer> {
//Verify function arguments
if (!verifyProductName(product)) {
throw new Error(`"${product}" is not a valid product.`);
}
return getUrlContents({ host: 'manifest.swtor.com', path: `/patch/${product}.patchmanifest` });
}