Skip to content
This repository was archived by the owner on Jun 2, 2020. It is now read-only.

passcod/moify.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Moify library

This is the official library for the moify.me service. It is used internally by the web interface.

Moify is a rate-limited service, this library is low-level and will return a fail if you hit the limit, leaving you to handle this and/or retry later. In this case, please follow an exponential backoff.

Install

npm install --save moify

Usage

let moify = require('moify')

moify.url('')
.then(moifiedUrl => void console.log(moifiedUrl))
.catch(console.error)

moify.file('/path/to/file.png') // or jpeg, or gif, or webm...
.then(moifiedBlob => {})

require('fs').createReadStream('file.gif').pipe(moify.blob())
moify.blob(require('fs').readFileSync('file.jpg')) // Buffers are fine

moify.cache('17264a72f73bc9233d83474e274f274237')
.then(moifiedUrl => {})

API

Promises are native ES6, and may be consumed by any Promise-aware library.

In browser environments, Blobs are used where Buffers are specified below, and the Stream variants are not available. In browsers where native Promises are not available, they are shimmed using jakearchibald's ES6 Promise polyfill.

moify.url(url: String[, options: Object]) -> Promise

//

moify.url([options: Object]) -> StreamReadWriter

//

moify.file(filename: String[, options: Object]) -> Promise

//

moify.file([options: Object]) -> StreamReadWriter

//

moify.blob(image: Buffer[, options: Object]) -> Promise

//

moify.blob([options: Object]) -> StreamReadWriter

//

moify.fromHash(hash: String[, options: Object]) -> Promise

//

moify.fromHash([options: Object]) -> StreamReadWriter

//

Options

storage: 's3' | false

//

hash: String | Buffer

//

shape: Not Implemented

//

position: Not Implemented

//

apikey: Not Implemented

//

About

Licensed under MIT.

About

Official JS library for the moify.me service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published