
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
@byte-this/html-metadata-reader
Advanced tools
Read all meta tags and their values from an HTML document without the use of the window object
Node JS solution to read all meta tags and their values from an HTML document. This is useful in cases where we need to read metadata from a document on a Node Js server, where we cannot do a document query. Unlike other solutions, this will retrieve all meta tag information, including arbitrary/non-standard tags.
For a demo + how to use: https://bytethisstore.com/articles/pg/html-document-metadata
const htmlDocumentMetadataReader = new HtmlDocumentMetadataReader();
const tags = htmlDocumentMetadataReader.readTagsFromDocument(htmlString);
console.log(tags);
The result will have this schema:
/*
* The structure of a tag is split as follows:
* <meta {key.labelName}="{key.value}" {value.labelName}="{value.value}">
* <meta {key.value}="{value.value}">
*/
[
//title is included, even though it is not technically a meta tag
{
"key": {
"labelName": "",
"value": "title"
},
"value": {
"labelName": "",
"value": "Test Page"
}
},
{
"key": {
"labelName": "",
"value": "charset"
},
"value": {
"labelName": "",
"value": "utf-8"
}
},
{
"key": {
"labelName": "name",
"value": "description"
},
"value": {
"labelName": "value",
"value": "something"
}
},
{
"key": {
"labelName": "name",
"value": "author"
},
"value": {
"labelName": "content",
"value": "Byte This!"
}
},
{
"key": {
"labelName": "property",
"value": "og:description"
},
"value": {
"labelName": "content",
"value": "something"
}
}
]
This can be formatted into a key-value pair object:
const keyValueObj = DocumentMetadataFormatter.toDictionary(metaTagsAr);
FAQs
Read all meta tags and their values from an HTML document without the use of the window object
The npm package @byte-this/html-metadata-reader receives a total of 4 weekly downloads. As such, @byte-this/html-metadata-reader popularity was classified as not popular.
We found that @byte-this/html-metadata-reader demonstrated a not healthy version release cadence and project activity because the last version was released 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.