Skip to content

Commit

Permalink
awesome
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyBurger committed Nov 14, 2024
1 parent 40b3fe7 commit 69943bf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/media-parser/src/create/iso-base-media/primitives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,15 @@ export const stringToPascalString = (str: string) => {

return buffer;
};

export const padToLength = (data: Uint8Array, totalLength: number) => {
if (data.length > totalLength) {
throw new Error('Data is longer than the total length');
}

if (data.length === totalLength) {
return data;
}

return combineUint8Arrays([data, new Uint8Array(totalLength - data.length)]);
};

0 comments on commit 69943bf

Please sign in to comment.