1.6.629 • Published 3 years ago

o-web v1.6.629

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

o-web

a Web-Request Module.

Install

npm install o-web

DEMO

normal

var web = require('o-web');
+async function(){
  var o = await web.get("https://www.bimwook.com:11180/woo/about.do");
  if(!o.error){
    console.log(o.data.toString());
  }
  else {
    console.log(o.error);
  }
}();

POST:

var web = require('o-web');
+async function(){
  var body = [];
  body.push("u=bamboo");
  body.push("p=******");
  var o = await web.post("https://www.bimwook.com:11180/woo/about.do", body.join("&"));
  if(!o.error){
    console.log(o.data.toString());
  }
  else {
    console.log(o.error);
  }
}();

You can also set headers

var web = require('o-web');
+async function(){
  var o = await web.get(
    "https://www.bimwook.com:11180/woo/about.do", 
    {"User-Agent":"Mozilla/5.0 (AS-YOU-WISH)", "Cookie":"foo=bar;"}
  );
  if(!o.error){
    console.log(o.data.toString());
  }
  else {
    console.log(o.error);
  }
}();

with proxy

var web = require('o-web');
+async function(){
  var o = await web.get("https://www.bimwook.com:11180/woo/about.do", {}, "127.0.0.1:10808");
  if(!o.error){
    console.log(o.data.toString());
  }
  else {
    console.log(o.error);
  }
}();

The return object:

{
  data:<Buffer>,
  text: <String>,
  error: <error>,
  code: <int>,
  headers: <object>
}

That's All.

1.6.629

3 years ago

1.2.60-7.1

3 years ago

1.3.629

3 years ago

1.2.629

3 years ago

1.2.618

3 years ago

1.2.607

3 years ago

1.1.827

5 years ago

1.1.826

5 years ago

1.1.825

5 years ago

1.1.317

5 years ago

1.0.1113

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago