Initial working version

This commit is contained in:
Samuel Kent
2022-12-22 20:22:22 +11:00
parent ce9675a1cc
commit ced7fa5092
902 changed files with 150252 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
import { IRandomReader } from '../type';
export declare const endTag2 = "LYRICS200";
export declare function getLyricsHeaderLength(reader: IRandomReader): Promise<number>;
+17
View File
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLyricsHeaderLength = exports.endTag2 = void 0;
exports.endTag2 = 'LYRICS200';
async function getLyricsHeaderLength(reader) {
if (reader.fileSize >= 143) {
const buf = Buffer.alloc(15);
await reader.randomRead(buf, 0, buf.length, reader.fileSize - 143);
const txt = buf.toString('binary');
const tag = txt.substr(6);
if (tag === exports.endTag2) {
return parseInt(txt.substr(0, 6), 10) + 15;
}
}
return 0;
}
exports.getLyricsHeaderLength = getLyricsHeaderLength;