upyun-http-signature

0.1.5 • Public • Published

upyun-http-signature

NPM version Build status Test coverage

a simple lib for generate a signature for upyun http REST api

Installation

$ npm install upyun-http-signature

Usage

sign(http_method, path, date, content_length, password, operater);

Arguments

  • http_method: HTTP method(eg, 'GET', 'PUT', etc)
  • path: request path
  • content_length: content-length of the request, if no request body, it should be 0
  • password: operator's password
  • operator: upyun bucket's operator

In Node.js

var sign = require('upyun-http-signature');
 
console.log(sign('GET', '/test', date, 10, 'password', 'operator'));

In browser (with browserify)

<script src="../dist/upyun-sign-browserify.min.js"></script>
<script>
var sign = require('upyun-http-signature');
 
var date = 'Wed Oct 08 2014 16:20:11 GMT+0800 (CST)';
console.log(sign('GET', '/test', date, 10, 'password', 'operator'));
</script> 

you can see the demo for this.

License

MIT © Leigh Zhu

/upyun-http-signature/

    Package Sidebar

    Install

    npm i upyun-http-signature

    Weekly Downloads

    5

    Version

    0.1.5

    License

    MIT

    Last publish

    Collaborators

    • lisposter