Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
html-tokenize
Advanced tools
Readme
transform stream to tokenize html
var fs = require('fs');
var tokenize = require('html-tokenize');
var through = require('through2');
fs.createReadStream(__dirname + '/table.html')
.pipe(tokenize())
.pipe(through.obj(function (row, enc, next) {
row[1] = row[1].toString();
console.log(row);
next();
}))
;
this html:
<table>
<tbody>blah blah blah</tbody>
<tr><td>there</td></tr>
<tr><td>it</td></tr>
<tr><td>is</td></tr>
</table>
generates this output:
[ 'open', '<table>' ]
[ 'text', '\n ' ]
[ 'open', '<tbody>' ]
[ 'text', 'blah blah blah' ]
[ 'close', '</tbody>' ]
[ 'text', '\n ' ]
[ 'open', '<tr>' ]
[ 'open', '<td>' ]
[ 'text', 'there' ]
[ 'close', '</td>' ]
[ 'close', '</tr>' ]
[ 'text', '\n ' ]
[ 'open', '<tr>' ]
[ 'open', '<td>' ]
[ 'text', 'it' ]
[ 'close', '</td>' ]
[ 'close', '</tr>' ]
[ 'text', '\n ' ]
[ 'open', '<tr>' ]
[ 'open', '<td>' ]
[ 'text', 'is' ]
[ 'close', '</td>' ]
[ 'close', '</tr>' ]
[ 'text', '\n' ]
[ 'close', '</table>' ]
[ 'text', '\n' ]
var tokenize = require('html-tokenize');
Return a tokenize transform stream t
that takes html input and produces rows
of output. The output rows are of the form:
[ name, buffer ]
The input stream maps completely onto the buffers from the object stream.
The types of names are:
cdata, comments, and scripts all use 'open'
with their contents appearing in
subsequent 'text'
rows.
There is an html-tokenize command too.
usage: html-tokenize {FILE}
Tokenize FILE into newline-separated json arrays for each tag.
If FILE is not specified, use stdin.
With npm, to get the library do:
npm install html-tokenize
or to get the command do:
npm install -g html-tokenize
MIT
FAQs
transform stream to tokenize html
The npm package html-tokenize receives a total of 507,476 weekly downloads. As such, html-tokenize popularity was classified as popular.
We found that html-tokenize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.