Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get: (buf, off): IID3v2header => {
return {
// ID3v2/file identifier "ID3"
fileIdentifier: new Token.StringType(3, 'ascii').get(buf, off),
// ID3v2 versionIndex
version: {
major: Token.INT8.get(buf, off + 3),
revision: Token.INT8.get(buf, off + 4)
},
// ID3v2 flags
flags: {
// Raw flags value
raw: Token.INT8.get(buf, off + 4),
// Unsynchronisation
unsynchronisation: common.strtokBITSET.get(buf, off + 5, 7),
// Extended header
isExtendedHeader: common.strtokBITSET.get(buf, off + 5, 6),
// Experimental indicator
expIndicator: common.strtokBITSET.get(buf, off + 5, 5),
footer: common.strtokBITSET.get(buf, off + 5, 4)
},
size: UINT32SYNCSAFE.get(buf, off + 6)
};
}
};
get: (buf, off): IID3v2header => {
return {
// ID3v2/file identifier "ID3"
fileIdentifier: new Token.StringType(3, 'ascii').get(buf, off),
// ID3v2 versionIndex
version: {
major: Token.INT8.get(buf, off + 3),
revision: Token.INT8.get(buf, off + 4)
},
// ID3v2 flags
flags: {
// Raw flags value
raw: Token.INT8.get(buf, off + 4),
// Unsynchronisation
unsynchronisation: common.strtokBITSET.get(buf, off + 5, 7),
// Extended header
isExtendedHeader: common.strtokBITSET.get(buf, off + 5, 6),
// Experimental indicator
expIndicator: common.strtokBITSET.get(buf, off + 5, 5),
footer: common.strtokBITSET.get(buf, off + 5, 4)
},
size: UINT32SYNCSAFE.get(buf, off + 6)
};
public get(buf: Buffer, off: number): IStszAtom {
const nrOfEntries = Token.INT32_BE.get(buf, off + 8);
return {
version: Token.INT8.get(buf, off),
flags: Token.INT24_BE.get(buf, off + 1),
sampleSize: Token.INT32_BE.get(buf, off + 4),
numberOfEntries: nrOfEntries,
entries: readTokenTable(buf, Token.INT32_BE, off + 12, this.len - 12, nrOfEntries)
};
}
}