Socket
Book a DemoInstallSign in
Socket

malasada

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

malasada

A reverse proxy server to convert, cache and response images in WebP format.

unpublished
latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

malasada Malasada

NPM version build status node version

A reverse proxy server to convert, cache and respond images in WebP format. Can be used standalone or as a Koa middleware.

Install

NPM

You'll need to install WebP binaries on your server, please see node-webp manual for installation.

Docker

You can also run malasada with Docker:

docker run --name malasada -p 80:3002 -v /path/to/config.json:/app/config.json -v /path/to/cache:/app/cache -d mudkip/malasada

Replace /path/to with the correct location of config.json and cache.

Configruation

A config.json file is required to run this program.

{
    "backendType": "remote",
    "backend": "http://upload.wikimedia.org",
    "maxAge": 3628800000,
    "forceWebP": false,
    "cacheRootPath": "/var/cache/malasada",
    "requestHeaders": {},
    "queue": 1,
    "port": 3002
  }
  • backendType: Can be remote or local.
  • backend: May be a http or https host when backendType is remote, or a local directory when backendType is local. Required.
  • maxAge: The max age (in second) sent to browsers.
  • forceWebP: When is true, the server always response WebP images when possible, otherwise it only respond WebP images when it is accepted by browsers in Accept header.
  • cacheRootPath: Where the cache files saves, defaults to cache directory of this program.
  • requestHeaders: Additional headers sent to backend, only useful when backendType is remote.
  • queue: Simultaneous WebP conversion tasks, defaults to 1.
  • port: The listen port of the server, only useful when used standalone.

Usage

When installed globally, it can be run with malasada --config config.json.

You can also use it as a middleware in your Koa instance:

const Koa = require('koa');
const malasada = require('malasada');

const app = new Koa();
app.use(malasada(config));

Remember this program is not designed to be a full-featured reverse proxy, the backend server should only be a static file server.

Cache Deletion

A PURGE request, or a GET request with /purge prefix can be used to delete cache of a certain path.

License

MIT

Notice

While the sweet malasada is used on 52Poké Wiki to handle hundreds of thousands requests daily. It currently lacks tests and significant features such as proper cache control and cache size management.

Pull requests and issues are welcome.

Keywords

webp

FAQs

Package last updated on 03 Jan 2018

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