node package manager



Build Status

imgix-core-js is an npm and Bower package that provides the common boilerplate for imgix server and client-side JavaScript-based functionality.

imgix-core-js adheres to the imgix-blueprint for definitions of its functionality.


imgix-core-js can be installed as either via npm or via bower:

$ npm install --save imgix-core-js


$ bower install --save imgix-core-js


Depending on your module system, using imgix-core-js is done a few different ways. The most common entry point will be the Client class. Whenever you provide data to imgix-core-js, make sure it is not already URL-encoded, as the library handles proper encoding internally.


var ImgixClient = require('imgix-core-js');
var client = new ImgixClient({
  host: "",
  secureURLToken: "<SECURE TOKEN>"
var url = client.buildURL("/path/to/image.png", {
  w: 400,
  h: 300
console.log(url); // => "…"

ES6 Modules

import ImgixClient from 'imgix-core-js'
let client = new ImgixClient({
  host: '',
  secureURLToken: '<SECURE TOKEN>'
let url = client.buildURL('/path/to/image.png', { w: 400, h: 300 });
console.log(url); // => '…'


var client = new ImgixClient({
  host: ''
  // Do not use signed URLs with `secureURLToken` on the client side,
  // as this would leak your token to the world. Signed URLs should
  // be generated on the server.
var url = client.buildURL('/path/to/image.png', { w: 400, h: 300 });
console.log(url); // => ""

What is the ixlib param on every request?

For security and diagnostic purposes, we sign all requests with the language and version of library used to generate the URL.

This can be disabled by passing a falsy value for the includeLibraryParam option to new ImgixClient:

new ImgixClient({
  host: '',
  includeLibraryParam: false


imgix-core-js uses mocha for testing. Here’s how to run those tests:

npm test

Publishing a new version

To publish a new version of the NPM package:

$ npm publish

The Bower package will be automatically updated when you create a new release in GitHub.