mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-23 18:52:16 +00:00
refactor: slice NCM parsing
This commit is contained in:
parent
bb9529b877
commit
8b628fd6ce
@ -8,8 +8,13 @@ export class NCMCrypto implements CryptoBase {
|
||||
ncm = new NCMFile();
|
||||
|
||||
async checkBySignature(buffer: ArrayBuffer) {
|
||||
const data = new Uint8Array(buffer);
|
||||
let len = 1024;
|
||||
try {
|
||||
this.ncm.open(new Uint8Array(buffer));
|
||||
while (len !== 0) {
|
||||
console.debug('NCM/open: read %d bytes', len);
|
||||
len = this.ncm.open(data.subarray(0, len));
|
||||
}
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user