Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
hyperstream
Advanced tools
stream html into html at a css selector
var hyperstream = require('hyperstream');
var fs = require('fs');
var hs = hyperstream({
'#a': fs.createReadStream(__dirname + '/a.html'),
'#b': fs.createReadStream(__dirname + '/b.html')
});
var rs = fs.createReadStream(__dirname + '/index.html');
rs.pipe(hs).pipe(process.stdout);
$ node example/hs.js
<html>
<body>
<div id="a"><h1>a!!!</h1></div>
<div id="b"><b>bbbbbbbbbbbbbbbbbbbbbb</b></div>
</body>
</html>
var hyperstream = require('hyperstream')
Return a duplex stream that takes an html stream as input and produces an html
stream as output, inserting the streams given by streamMap
at the css selector
keys.
If streamMap
values are strings or functions, update the contents at the css
selector key with their contents directly without using a stream.
If streamMap
values are non-stream objects, iterate over the keys and set
attributes for each key.
These attributes are special. Each attribute can be a string, buffer, or stream:
_html
- set the inner content as raw html_text
- set the inner content as text encoded as html entities_append
, _appendText
- add text to the end of the inner content encoded as
html entities_appendHtml
- add raw html to the end of the inner content_prepend
, _prependText
- add text to the beginning of the inner content
encoded as html entities_prependHtml
- add raw html to the beginning of the inner contextFor example, to set raw html into the inner content with the _html
attribute,
do:
hyperstream({
'#content': {
_html: stream,
'data-start': 'cats!',
'data-end': 'cats!\ufff'
}
})
You can also specify string operations for properties with an object instead of a string. The object can have these properties:
append
prepend
Object properties are particularly handy for adding classes:
hyperstream({
'.row': {
class: { append: ' active' }
}
})
which turns:
<div class="row"><b>woo</b></div>
into:
<div class="row active"><b>woo</b></div>
Proxy through methods to the underlying trumpet instance.
With npm do:
npm install hyperstream
MIT
FAQs
stream html into html at a css selector
The npm package hyperstream receives a total of 659 weekly downloads. As such, hyperstream popularity was classified as not popular.
We found that hyperstream 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.