This package has been deprecated

Author message:

this package is no longer maintained.

tinyget

0.2.13 • Public • Published

tinyget

A tiny http client for nodejs & browser

NPM Version NPM Downloads NPM Downloads NPM Downloads

Installation

$ npm install tinyget --save

Or, via webmodules

$ wpm install tinyget --save

Or, via bower

$ bower install tinyget --save

Usage

Node.js (commonjs)

var tinyget = require('tinyget');

Browser (global)

var tinyget = window.TinyGet;

Example

// default is get
tinyget('/path/file').qry({key: value}).exec(function(err, result) {
    // TODO
});
 
// get, post, put, delete, options
tinyget.post('/path/file').payload({key:'value'}).exec(function(err, result) {
    // TODO
});
 
// alt style 1
tinyget({
    url: '/path/file',
    payload: {key:'value'}
}).exec(function(err, result) {
    // TODO
});
 
tinyget.post({
    url: '/path/file',
    contentType: 'application/json',
    evalType: 'json',
    payload: {key:'value'}
}).exec(function(err, result) {
    // TODO
});
 
// alt style 2
tinyget({
    url: '/path/file',
    payload: {key:'value'}
}, function(err, result) {
    // TODO
});
 
tinyget.put({
    url: '/path/file',
    payload: {key:'value'}
}, function(err, result) {
    // TODO
});

Options

  • options : url string or object
    • url: remote url(string), required.
    • payload: payload (string/object), default is null.
    • qry: query string (string/object), default is null.
    • contentType: request content-type (string), default when payload is object application/json else text/form-url-encoded
    • responseType: xhr.responseType(xhr2) (string), default is null
    • type: response object eval type text, json, xml (string), default is auto
    • headers: request headers (object), default is null.
    • sync: sync request (boolean), default is false

License

Licensed under the MIT License. See LICENSE for the full license text.

Readme

Keywords

Package Sidebar

Install

npm i tinyget

Weekly Downloads

40

Version

0.2.13

License

MIT

Unpacked Size

244 kB

Total Files

13

Last publish

Collaborators

  • admin.attrs
  • aquarela53
  • joje