{"id":17049328,"url":"https://github.com/samccone/infestor","last_synced_at":"2025-04-12T16:17:16.773Z","repository":{"id":12544455,"uuid":"15214571","full_name":"samccone/infestor","owner":"samccone","description":"Inject content into your server responses","archived":false,"fork":false,"pushed_at":"2015-08-18T15:51:44.000Z","size":350,"stargazers_count":7,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T16:16:48.707Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samccone.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":"contributing.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-16T01:38:10.000Z","updated_at":"2021-06-21T12:32:21.000Z","dependencies_parsed_at":"2022-08-07T07:00:19.565Z","dependency_job_id":null,"html_url":"https://github.com/samccone/infestor","commit_stats":null,"previous_names":["samccone/injector"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samccone%2Finfestor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samccone%2Finfestor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samccone%2Finfestor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samccone%2Finfestor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samccone","download_url":"https://codeload.github.com/samccone/infestor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248594191,"owners_count":21130316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T09:54:24.284Z","updated_at":"2025-04-12T16:17:16.736Z","avatar_url":"https://github.com/samccone.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Infestor\n\n[![npm](http://img.shields.io/npm/v/infestor.svg?style=flat)](https://badge.fury.io/js/infestor)\n[![tests](http://img.shields.io/travis/samccone/infestor/master.svg?style=flat)](https://travis-ci.org/samccone/infestor)\n[![coverage](http://img.shields.io/coveralls/samccone/infestor.svg?style=flat)](https://coveralls.io/r/samccone/infestor)\n\nInject content into your server responses\n\n### Why should you care?\n\nThere are times when all you want to do is inject a JS file or custom markup into the req res cycle without forcing the content generator to include custom markup on their side.\n\nThis is where infestor comes in. Just specify the regex insertion point and content. Then you are good to go.\n\n### Installation\n\n`npm install infestor --save`\n\n### Infestor Options\n* `content`: A string of content to be injected into the response\n* `injectAt`: The location where your content will be inject at.\n* `append`: A boolean representing if your custom content should just be appended to the response (overrides `injectAt`).\n* `injectContent`: An overrideable method to define how your content is inserted into the response. It is naive to think that infestor can cover all of the use cases for everyone. So instead of bloating the core injection method, we provide a simple to use hook into the primary buisness logic for inserting custom content.\n\n### Usage\n\n```js\nvar http = require('http');\n    connect = require('connect'),\n    infestor = require('infestor'),\n    serveStatic  = require('serve-static');\n\nvar app = connect()\n            .use(infestor({\n              content: \"\u003ch2\u003e injected content! \u003c/h2\u003e\",\n              injectAt: '/\u003c\\/html\u003e/'\n            })\n            .use(serveStatic(__dirname));\n\nvar server = http.createServer(app).listen(1111)\n```\n\nMake sure that you place the infestor middleware before you serve your content or else infestor will not work.\n\n\n### License \u0026 Contributing\n\n- Details on the license [can be found here](LICENSE.md)\n- Details on running tests and contributing [can be found here](contributing.md)\n\n-----------\n\n![](http://media.moddb.com/images/mods/1/10/9329/63165.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamccone%2Finfestor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamccone%2Finfestor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamccone%2Finfestor/lists"}