Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@fix-webm-duration/parser
Advanced tools
Parse webm files into individual sections, edit the sections, and compile the file from edited sections back together
Parse webm files into individual sections, edit the sections, and compile the file from edited sections back together.
Warning: it's an internal implementation package, the interfaces here can change at any moment! Please don't use it directly in production code, only for debugging contents of webm files while developing!
Install from a package manager:
npm install @fix-webm-duration/parser
import { WebmFile } from "@fix-webm-duration/parser";
const file = await WebmFile.fromBlob(blob);
It will return an instance of WebmFile
, which is a tree of sections with IDs.
WebmFile
and WebmContainer
are containers for other sections,
while all other classes of webm nodes (WebmUint
, WebmFloat
, WebmString
) are the final leaves of the tree.
WebmBase
is the base node class that is uses for nodes with unrecognized IDs
(the map of webm nodes in the library is not full, it's only a set of nodes required to fix webm duration).
The data
field of a parsed WebmContainer
(or WebmFile
) object
contains a list of child nodes (which could be leaves or other sections).
Use the getSectionById
method to get a direct child section by ID, e.g.
const segmentSection: WebmContainer | null = file.getSectionById(0x8538067);
Section IDs could be found in the sections.ts file.
Use the setValue
method to modify the value of nodes, e.g.
const durationSection = infoSection.getSectionById(0x489);
if (!durationSection) throw new Error("Duration section not found");
durationSection.setValue(60000);
Access regular array method for the data
field to add or remove child nodes for a sections, e.g.
const durationSection = new WebmFloat("Duration");
durationSection.setValue(duration);
infoSection.data!.push({
id: 0x489,
data: durationSection,
});
Call updateByData
method of all modified WebmContainer
and WebmFile
objects in the reverse order,
i.e. starting from the most nested nodes, and ending with the WebmFile
object.
Call the toBlob
method of the file to convert the parsed file to blob.
Pass MIME type to it if it's not default, e.g. file.toBlob("audio/webm")
.
1.0.1 (2024-07-05)
This was a version bump only, there were no code changes.
Move to monorepo
FAQs
Parse webm files into individual sections, edit the sections, and compile the file from edited sections back together
We found that @fix-webm-duration/parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.