-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(tile-converter): create SLPK hash during serve #2565
Conversation
modules/i3s/test/index.js
Outdated
@@ -12,3 +12,4 @@ import './zip-utils/data-view-provider.spec'; | |||
import './zip-utils/cd-file-header.spec'; | |||
import './zip-utils/local-file-header.spec'; | |||
import './search-from-the-end.spec'; | |||
import './end-of-dentral-directory.spec'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import './end-of-dentral-directory.spec'; | |
import './end-of-central-directory.spec'; |
} | ||
let hashData: HashElement[]; | ||
if (cdFileHeader?.fileName !== '@specialIndexFileHASH128@') { | ||
cb?.("SLPK doesn't contain hash file"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix warning
import {ZipSignature, searchFromTheEnd} from './search-from-the-end'; | ||
import {SLPKArchive} from './slpk-archieve'; | ||
import {searchFromTheEnd} from '../parse-zip/search-from-the-end'; | ||
import {HashElement, SLPKArchive, compareHashes} from './slpk-archieve'; | ||
|
||
/** | ||
* Creates slpk file handler from raw file | ||
* @param fileProvider raw file data | ||
* @returns slpk file handler | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty line between comment and function
let data = await this.getFileBytes(path); | ||
if (!data) { | ||
data = await this.getFileBytes(path.toLocaleLowerCase()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Datasets made by spec should work faster. As lowercase
is by spec so it should work faster. I'd suggest to seek it first. If search by spec is not working the code will try to find it in another way.
Point it out in the comment with reference to the spec.
@@ -9,6 +10,8 @@ export type ZipCDFileHeader = { | |||
compressedSize: bigint; | |||
/** Uncompressed size */ | |||
uncompressedSize: bigint; | |||
/** Extra field size size */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misprint?
/** Extra field size size */ | |
/** Extra field size */ |
CD_LOCAL_HEADER_OFFSET_OFFSET: 42n, | ||
CD_FILE_NAME_OFFSET: 46n | ||
}; | ||
): Promise<ZipCDFileHeader | undefined> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined
is not a good type to return it explicitly. null
is better
): Promise<ZipCDFileHeader | undefined> => { | |
): Promise<ZipCDFileHeader | null> => { |
Buffer.from(signature) | ||
) !== 0 | ||
) { | ||
return Promise.resolve(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Promise.resolve(undefined); | |
return null; |
|
||
/** | ||
* Parses end of central directory record of zip file | ||
* @param fileProvider - buffer containing whole array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it work only with array or with file handle as well?
* @param fileProvider - buffer containing whole array | |
* @param fileProvider - FileProvider instance |
slpkArchive = await parseSLPK(await FileHandleProvider.from(fullLayerPath), (msg) => | ||
console.log(msg) | ||
); | ||
console.log('Server ready to use'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log('Server ready to use'); | |
console.log('The server is ready to use'); |
No description provided.