npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-imgoptimize

v0.4.5

Published

Proxy server for image optimization on Node.JS use (fastify, axios, sharp)

Downloads

12

Readme

node-imgoptimize

Build Status Maintainability Test Coverage

js-standard-style License

release NPM downloads Known Vulnerabilities Greenkeeper badge

Proxy server for image optimization on Node.JS use (fastify, axios, sharp) Automatic recognition of browser support formats WebP

Install

Yarn

yarn add node-imgoptimize
git clone https://github.com/AntonLukichev/node-imgoptimize.git
yarn install

NPM

npm install node-imgoptimize --save
git clone https://github.com/AntonLukichev/node-imgoptimize.git
npm install

Requires node >= 8.0, but I recommended use >= 10.0 LTS

Install as service on Ubuntu

Heroku

example https://node-imgoptimize.herokuapp.com/

Install on Heroku Deploy to Heroku

use Docker

$ git clone https://github.com/AntonLukichev/node-imgoptimize.git
$ cd ./node-imgoptimize
$ docker build -t node-imgoptimize .
$ docker run -it --rm -p 3000:3000 -e NODE_ENV=production node-imgoptimize
$ git clone https://github.com/AntonLukichev/node-imgoptimize.git
$ cd ./node-imgoptimize
$ docker-compose build
$ docker-compose up

see tips for Docker

Example Usage

{url}?w=500&q=80

support parameters (after "?"):

w - image width; h - image height; q - image quality, 80 recommended for JPEG and WebP; fm - image format, list in config.js and default jpeg or webp (if browser supports it);

Example config

Edit defaults config for you need (automatically created after the first run)

./config/config.js

./config/server.js

ToDo

v0.2.0:

  • [x] generate source url with original request parameters
  • [x] caching original file
  • [x] support a large number of files

v0.3.0:

  • [x] add multiple path URI
  • [x] add JPEG and WebP options

v0.4.0:

  • [x] custom log level
  • [x] documentation API in Swagger
  • [x] add docker
  • [x] support Heroku

v0.5.0:

  • [x] add monitoring errors sentry.io
  • [x] default favicon
  • [ ] add tests

I plan to implement in the future:

  • expand API
  • add options Low Quality Image Placeholders (LQIP)
  • add Client Hints (headers DPR, Viewport-Width, Width) for support Chrome, Opera, Android Chrome
  • add support another formats (GIF, PNG, SVG...)
  • divide the functionality into modules up to version 1.0.0
  • support PAAS (~~Heroku~~, Zeit, Nanobox...)
  • add support HTTP2
  • add security protection
  • add support redis/mongo for cache info
  • add image operations (rotate, blur, normalise...)

Lazy loading

If you'd like to lazy load images, I recommend using lazysizes.

FAQ

How add custom favicon

Simple copy your favicon.ico file in root directory project

Security

Node.js Security Checklist

Production Best Practices: Security

Contributing

See the CONTRIBUTING file here

License

MIT

Copyright (c) Anton Lukichev