0.2.10 • Published 4 years ago

granny v0.2.10

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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 git@github.com: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

0.2.10

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.2

4 years ago

0.1.5

4 years ago

0.1.2

4 years ago

0.0.1

4 years ago

0.0.0-reserved

8 years ago