Create a image url by proxy that is camo.
$ npm install camo-url --save
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
Initialize this package.
- options ... Type:
object
... information of your camo server (optional)- host: host name (optional)
- Type:
string
- Default:
'http://localhost:8081'
- Type:
- key: camo key (optional)
- Type:
string
- Default:
'0x24FEEDFACEDEADBEEFCAFE'
- Type:
- type: proxied url type (optional)
- Type:
'query'
or'path'
- Default:
'query'
- Type:
- host: host name (optional)
Generate a proxied image URL.
- imageUrl: an absolute URL of an image
- Type:
string
- Type:
- returns: proxied URL
- Type:
string
- Type:
Get digest of an image URL.
- imageUrl: an absolute URL of an image
- Type:
string
- Type:
- returns: digest of the URL
- Type:
string
- Type:
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
MIT © Pine Mizune