🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@awes-io/resize

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@awes-io/resize

Cloudflare Image Resizing: simple API for URL generation.

latest
Source
npmnpm
Version
2.1.0
Version published
Weekly downloads
33
266.67%
Maintainers
3
Weekly downloads
 
Created
Source

Awes.io logo

Cloudflare Image Resizing

Simple API for URL generation.

Last version License Analytics

Setup

yarn add @awes-io/resize # yarn 
npm i @awes-io/resize # npm 

Basic use

import resize from '@awes-io/resize'

// get the image with width 640px
resize('https://example.com/images/example.jpg', 640)

// result: https://example.com/cdn-cgi/image/w=640,q=75/images/example.jpg

Method

// URL generation with parameters for resizing
resize(url, width = null, aspect = null, options = null)

Options

NameTypeDefaultDescription
urlString-Link to the original image.
widthNumbernull(Optional) Width of the image, undefined by default.
aspectStringnull(Optional) Aspect ratio for image, ie: 16x9, 4:3, etc.
optionsObjectnull(Optional) domain, protocol, crop, prefix
options.optionsObjectnull(Optional) List of options for modify parameters for image. More info: https://developers.cloudflare.com/images/about/

Cloudflare Image Resizing Documentation

Ensure to write proper commit message according to Git Commit convention

Keywords

cloudflare

FAQs

Package last updated on 07 Apr 2020

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