New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-sharp

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-sharp

Real-time image processing for your express application

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
482
decreased by-5.49%
Maintainers
1
Weekly downloads
 
Created
Source

express-sharp

express-sharp adds real-time image processing routes to your express application. Images are processed with sharp, a fast Node.js module for resizing images.

Installation

$ npm install express-sharp --save

See sharp installation for additional installation instructions.

Usage

Example app.js:

'use strict';

var express = require('express');
var app = express();
var scale = require('express-sharp');

var options = {baseHost: 'mybasehost.com'};
app.use('/my-scale', scale(options));

app.listen(3000));

Render http://mybasehost.com/image.jpg with 400x400 pixels:

GET /my-scale/resize/400?url=http://mybasehost.com/image.jpg HTTP/1.1
Host: localhost:3000

--> invokes in background:
  GET image.jpg HTTP/1.1
  Host: mybasehost.com

Same as above, but with 80% quality, webp image type and with progressive enabled:

GET /my-scale/resize/400?format=webp&quality=80&progressive=true&url=http://mybasehost.com/image.jpg HTTP/1.1
Host: localhost:3000

Options

var scale = require('express-sharp');
app.use('/some-path', scale(options));

Supported options:

baseHost

Specify the HTTP base host from wich images are to be requested.

Path and query params

format

Output image format.

Default: output format of the requested image.

Valid values: every valid sharp output format string, i.e. jpeg, gif, webp or raw.

progressive

Use progressive (interlace) scan for JPEG and PNG output. This typically reduces compression performance by 30% but results in an image that can be rendered sooner when decompressed.

Use &progressive=true to enable progressive scan.

quality

The output quality to use for lossy JPEG, WebP and TIFF output formats. The default quality is 80.

quality is a Number between 1 and 100.

url

URL/path to original image.

Keywords

FAQs

Package last updated on 27 Nov 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc