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
+32
View File
@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VorbisDecoder = void 0;
const Token = require("token-types");
class VorbisDecoder {
constructor(data, offset) {
this.data = data;
this.offset = offset;
}
readInt32() {
const value = Token.UINT32_LE.get(this.data, this.offset);
this.offset += 4;
return value;
}
readStringUtf8() {
const len = this.readInt32();
const value = Buffer.from(this.data).toString('utf-8', this.offset, this.offset + len);
this.offset += len;
return value;
}
parseUserComment() {
const offset0 = this.offset;
const v = this.readStringUtf8();
const idx = v.indexOf('=');
return {
key: v.slice(0, idx).toUpperCase(),
value: v.slice(idx + 1),
len: this.offset - offset0
};
}
}
exports.VorbisDecoder = VorbisDecoder;