1.6.629 • Published 2 years ago

o-web v1.6.629

Weekly downloads
-
License
MIT
Repository
-
Last release
2 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

2 years ago

1.2.60-7.1

2 years ago

1.3.629

2 years ago

1.2.629

2 years ago

1.2.618

2 years ago

1.2.607

2 years ago

1.1.827

4 years ago

1.1.826

4 years ago

1.1.825

4 years ago

1.1.317

4 years ago

1.0.1113

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago