Giter Site home page Giter Site logo

xd-synchttp's Introduction

xd-synchttp - a http library for node

Build Status

This is a synchronous http library for node.js. __It supports GET/POST request and focuses on high performance.

Install with:

npm install xd-synchttp

OS support

Linux-x64
Win32(x64/ia32)
MacOS(x64)

Usage Example

var sync = require("xd-synchttp");

var response_get = "";
var response_post = "";
var image_size = new Object();
var timeout = 3;
var post_data = {"field1":"1","field2":"2"};
var url = "http://www.baidu.com";
try{
	/*
	this is old function!
	response_get = sync.http_get(url,timeout);
	response_post = sync.http_post(url,post_data,timeout);
	*/
	//notify! you can call it by sync.sync_http(url);
	response_get = sync.sync_http(url,'get',{},timeout);
	response_post = sync.sync_http(url,'post',post_data,timeout);
	image_size = sync.get_image_size("http://wmod.66rpg.com/res/loading.gif");

}
catch(err){
	console.log(err);
}
console.log(response_get);
console.log(response_post);
console.log(image_size);

Note that the API is not support https.

Promises

not supported

API

"http_get"

you can use sync_http to instead of deprecated API

http_get(string,number);

http_get send a GET request

"http_post"

you can use sync_http to instead of deprecated API

http_post(string,object,number);

http_post send a POST request

"sync_http"

sync_http(string,string,object,number)

'sync_http' send a http request,support RESUFUL(get,post,delete,put,patch)

"get_image_size"

get_image_size(string);

get_image_size can get size of image from http or local file

How to Contribute

  • Open a pull request or an issue about what you want to implement / change. We're glad for any help!
  • Please be aware that we'll only accept fully tested code.

Contributors

The original author of xd-synchttp is Jing HAO

License

GPL

xd-synchttp's People

Contributors

haojingus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

xd-synchttp's Issues

fixed length bug

you need check length of body,http body may be missed。
ps:http.c line:183

Needs ARM support

The ARM architecture has been gaining popularity in the server market recently. With server giants such as AWS pushing the use of ARM servers, and Apple soon changing to ARM on consumer electronics, I would recommend adding support for the ARM architecture. Currently, only the x86_64/amd64 architecture is supported.

Need to support HTTPS

This is necessary.

OpenSSL has entered the testing phase。but NAPI's makefile encountered some problems!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.