Giter Club home page Giter Club logo

granny-js-client's Introduction

A client library from Granny server

A library for Granny image delivery server

npm Join the chat at https://gitter.im/granny-js/community

Ecosystem

image

granny-server-backend - Backend service with API exposed to upload and serve/manipulate images
granny-js-client - Client library that works both in nodejs and browser. Makes API calls easier
granny-server-frontend - Frontend APP that uses client to manage your CDN domains and settings
granny-server-cron - Utility app

Setup

This library can be used in both nodejs and browser environment. Browser clint made only for staging or admin panel development, because you can expose your credentials in browser.

NPM

npm i granny

Building from source

git clone [email protected]:mrspartak/granny-js-client.git
cd granny-js-client

//if you need browser version
npm run build
//request to your browser build/index.js

//if you need nodejs version it is stored in src/index.js

Or download latest release
npm

Basic usage

Nodejs

const Granny = require('granny')

const grannyApi = new Granny({
	domain: 'https://cdn.example.com', //url to Granny server backend
	accessKey: 'key',
	accessSecret: 'secret'
})

var [err, result] = await grannyApi.uploadImage({path: '/users/sergio.jpeg', image: './tmp/DSCF6278.jpg'})
console.log(result.imageUrl)
/*
	result.imageUrl = https://cdn.example.com/i/users/sergio.jpeg

	Now you can use direct link or modify image on fly
	https://cdn.example.com/i/r=100/_/users/sergio.jpeg - will resize image to 100x100
	https://cdn.example.com/i/width=500,format=webp/_/users/sergio.jpeg - will resize to width=500 saving aspect ratio and format to webp
*/

API

Currently here: https://github.com/mrspartak/granny-js-client/blob/master/API.md

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.