Coder Social home page Coder Social logo

yonle / bandwidth-hero-proxy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ayastreb/bandwidth-hero-proxy

5.0 0.0 1.0 123 KB

Fork of bandwidth-hero-proxy with additional fixups.

Home Page: https://bandwidth-hero.com/

License: MIT License

JavaScript 99.80% Procfile 0.20%

bandwidth-hero-proxy's Introduction

Bandwidth Hero Data Compression Service

This data compression service is used by Bandwidth Hero browser extension. It compresses given image to low-res WebP or JPEG image. Optionally it also converts image to greyscale to save even more data.

It downloads original image and transforms it with Sharp on the fly without saving images on disk.

This is NOT an anonymizing proxy โ€” it downloads images on user's behalf, passing cookies and user's IP address through to the origin host.

Fork Notable Changes

  • Cluster support
  • Change on codes, Including how it handle buffers
  • Added animation support (Which is CPU intensive. Disable by setting NO_ANIMATE in env variable)
  • Fixed CORS problems

Deployment Requirement

  • Atleast NodeJS >= 14 is installed.
  • libvips >= 8.14.2 (You should not need to compile libvips from source if sharp could be installed in your machine/container without any problem)

Setting up

Clone the repository, and install required dependencies

git clone https://github.com/Yonle/bandwidth-hero-proxy
npm install

Once finished, Start the server.

node server.js

You may change / set PORT env variable if you want to listen to another port.

If you think your forked cluster is less than 2, You could set CLUSTERS env variable with integer value depending how many clusters you would like to fork.

Using the server

You could also use the server without the need for using bandwidth hero proxy.

The following querystrings parameters is required on request:

  • url: URL of the image (required)
  • jpeg: Whenever to use jpeg format for compression instead of webp (Default: false)
  • bw: Convert the image into grayscale (Default: Yes)
  • l: Image quality (Default: 40% of the original image)

Request URI Example:

https://bwhero.example.com/?url=https%3A%2F%2Fexample.com%2Fbig_image.jpg&bw=0&l=40

Response headers:

  • x-original-size: The original size of the image in bytes
  • x-bytes-saved: How many bytes was saved from the original image

At some point, x-proxy-bypass may appears in header when the server prefers to proxy the non-image content to client.

bandwidth-hero-proxy's People

Contributors

ayastreb avatar dkocich avatar yonle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Forkers

cheeenx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.