npm install -g xd-synchttp
安装完成后,示例代码如下。其他Http方法在Npm官网有例子。
const sync = require('xd-synchttp');
let content = "";
try{
content = sync.http_get('http://www.csdn.net',0);//0为不超时,其他数值为超时秒数
}
catch(err)
{
console.log(err);
}
这是一个围绕开源游戏软硬件的个人博客
npm install -g xd-synchttp
安装完成后,示例代码如下。其他Http方法在Npm官网有例子。
const sync = require('xd-synchttp');
let content = "";
try{
content = sync.http_get('http://www.csdn.net',0);//0为不超时,其他数值为超时秒数
}
catch(err)
{
console.log(err);
}