0.2.0 • Published 7 years ago

camo-url v0.2.0

Weekly downloads
388
License
MIT
Repository
github
Last release
7 years ago

camo-url

npm version Build Status Coverage Status Dependency Status devDependency Status

Create a image url by proxy that is camo.

Getting started

$ npm install camo-url --save

Examples

It's very easy to use.

var camoUrl = require('camo-url')({
  host: 'https://camo.yourdomain.com',
  key: 'your_camo_key'
});

console.log(camoUrl('http://www.example.com/example.jpg'));
// => https://camo.yourdomain.com/c8b84571f98f34c41f7b4810a605e06d872eecd0?url=http%3A%2F%2Fwww.example.com%2Fexample.jpg

References

require('camo-url')(options)

Initialize this package.

  • options ... Type: object ... information of your camo server (optional)
    • host: host name (optional)
      • Type: string
      • Default: 'http://localhost:8081'
    • key: camo key (optional)
      • Type: string
      • Default: '0x24FEEDFACEDEADBEEFCAFE'
    • type: proxied url type (optional)
      • Type: 'query' or 'path'
      • Default: 'query'

camoUrl(imageUrl)

Generate a proxied image URL.

  • imageUrl: an absolute URL of an image
    • Type: string
  • returns: proxied URL
    • Type: string

camoUrl.digest(imageUrl)

Get digest of an image URL.

  • imageUrl: an absolute URL of an image
    • Type: string
  • returns: digest of the URL
    • Type: string

FAQ

Q. How do I create a GitHub style camo's URL?

A. Please try type: 'path' option.

var camoUrl = require('camo-url')({
  host: 'https://camo.yourdomain.com',
  key: 'your_camo_key',
  type: 'path'
});

console.log(camoUrl('http://www.example.com/example.jpg'));
// => https://camo.yourdomain.com/c8b84571f98f34c41f7b4810a605e06d872eecd0/687474703a2f2f7777772e6578616d706c652e636f6d2f6578616d706c652e6a7067

License

MIT © Pine Mizune

0.2.0

7 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago