obfuscator-middleware

Obfuscate and serve your JS files with a middleware

Usage no npm install needed!

<script type="module">
  import obfuscatorMiddleware from 'https://cdn.skypack.dev/obfuscator-middleware';
</script>

README

Obfuscator Middleware NPM Version node JavaScript Style Guide

The way this middleware works is it's an express middleware for serving minified obfuscated Javascript files. You can serve it at a certain path and method.

Methods

The object obtained from requiring is the init function which will return the middleware.

  • obf(options) (this will return a middleware of req, res, next)
  • options: {store, location, param}

The default options are options: {require('store'), './', 'fileName'}

The param option refers to what parameter we are looking for i.e :fileName is the correct way to work with the default options.

Example

const obf = require("./obfuscator");
app.get('/scripts/:fileName.js', obf({location: './assets/scripts/'}));

In this example, anything requesting GET from /scripts/*.js will be found from ./assets/scripts/ and served obfuscated.