Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

script-injector

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

script-injector

Inject inline javascript into an HTML stream.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
239
decreased by-26.69%
Maintainers
1
Weekly downloads
 
Created
Source

#script-injector

  1. provides a through stream that allows you to inject inline javascript into an html text stream.
  2. Uses trumpet to parse your html.
  3. Should only be used for good, never for evil

Installation

npm install script-injector

How to use

Just pipe a stream of html through script-injector. You can pass in either some stringified code or a function object. What could be easier?

scriptInjector = require('script-injector');

// Then do something like this somewhere else

fs.createReadStream('anHTMLFile')
  .pipe(scriptInjector(aFunction))
  .pipe(someOtherPlace);

script-injector will insert the provided code before your first script tags, or just before </body> if you don't have any other scripts.

Keywords

FAQs

Package last updated on 13 Apr 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc