
Product
Introducing Reports: An Extensible Reporting Framework for Socket Data
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.
@voliware/node-inject
Advanced tools
Inject data into another file based on tags
Suppose you want to inject HTML templates into a main HTML file. For example, you are building a shop page and you want to inject a shopping cart icon and an item list table.
/templates/itemlist.html
<table id="itemlist">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
</tr>
</thead>
</table>
/templates/shoppingcart.html
<div id="shoppingcart">
<div id="carticon"></div>
<div id="itemcount"></div>
<div id="paynow"></div>
</div>
Into a main HTML file
/templates/index.html
<!doctype html>
<html lang="en">
<head>
<title>Shop</title>
</head>
<body>
<!-- inject:itemlist -->
<!-- inject:shoppingcart -->
</body>
</html>
Just write and execute the following code
const Inject = require('@voliware/node-inject');
let inject = new Inject()
.inject("./templates/itemlist.html", 'itemlist')
.inject("./templates/shoppingcart.html", 'shoppingcart')
.into("./templates/index.html")
.saveas("./index.html")
.run();
And you'll end up with
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Shop</title>
</head>
<body>
<table id="itemlist">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
</tr>
</thead>
</table>
<div id="shoppingcart">
<div id="carticon"></div>
<div id="itemcount"></div>
<div id="paynow"></div>
</div>
</body>
</html>
Install with node package manager
npm install @voliware/node-inject
Include in a file
const Inject = require('@voliware/node-inject');
FAQs
Inject data into another file using tags
We found that @voliware/node-inject 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.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.