stream html into html at a css selector
var hyperstream = ;var fs = ;var hs =;var rs = fs;rs;
$ node example/hs.js<html><body><div id="a"><h1>a!!!</h1></div><div id="b"><b>bbbbbbbbbbbbbbbbbbbbbb</b></div></body></html>
var 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
streamMap values are strings or functions, update the contents at the css
selector key with their contents directly without using a stream.
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
_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
_prependText- add text to the beginning of the inner content encoded as html entities
_prependHtml- add raw html to the beginning of the inner context
For example, to set raw html into the inner content with the
You can also specify string operations for properties with an object instead of a string. The object can have these properties:
Object properties are particularly handy for adding classes:
Proxy through methods to the underlying trumpet instance.
With npm do:
npm install hyperstream