ipx-client

0.5.2 • Public • Published
IPX Logo

NPM Vernion NPM Downloads Bundle Size

IPX Client for Node.js and Browser

See IPX for more information.

Install package:

npm i ipx-client
yarn install ipx-client

Import client:

import { img } from 'ipx-client'
 
const { img } = require('ipx-client')

img() is a factory function to configure base options:

// getImage: (path, opts?, format?) => URL
const getImage = img({
  baseURL = 'https://cdn.example.com',
  basePath = 'uploads',
  opts = [], // Default opts
  format = 'jpg',
  presets: {
    chrome400: {
      format: 'webp',
      opts: { s: ['400', '400']}
    }
  }
})
 
getImage('posts/ipx.png', { w: 200 }) // => https://cdn.example.com/jpg/w_200/uploads/posts/ipx.png
 
getImage.chrome400('posts/ipx.png') // => https://cdn.example.com/webp/s_400_400/uploads/posts/ipx.png

Readme

Keywords

none

Package Sidebar

Install

npm i ipx-client

Weekly Downloads

1

Version

0.5.2

License

MIT

Unpacked Size

8.63 kB

Total Files

7

Last publish

Collaborators

  • farnabaz
  • pi0