stuff
This commit is contained in:
21
buildfiles/app/node_modules/metaflac-js2/lib/formatVorbisComment.js
generated
vendored
Normal file
21
buildfiles/app/node_modules/metaflac-js2/lib/formatVorbisComment.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
module.exports = (vendorString, commentList) => {
|
||||
const bufferArray = [];
|
||||
const vendorStringBuffer = Buffer.from(vendorString, 'utf8');
|
||||
const vendorLengthBuffer = Buffer.alloc(4);
|
||||
vendorLengthBuffer.writeUInt32LE(vendorStringBuffer.length);
|
||||
|
||||
const userCommentListLengthBuffer = Buffer.alloc(4);
|
||||
userCommentListLengthBuffer.writeUInt32LE(commentList.length);
|
||||
|
||||
bufferArray.push(vendorLengthBuffer, vendorStringBuffer, userCommentListLengthBuffer);
|
||||
|
||||
for (let i = 0; i < commentList.length; i++) {
|
||||
const comment = commentList[i];
|
||||
const commentBuffer = Buffer.from(comment, 'utf8');
|
||||
const lengthBuffer = Buffer.alloc(4);
|
||||
lengthBuffer.writeUInt32LE(commentBuffer.length);
|
||||
bufferArray.push(lengthBuffer, commentBuffer);
|
||||
}
|
||||
|
||||
return Buffer.concat(bufferArray);
|
||||
};
|
Reference in New Issue
Block a user