first commit

This commit is contained in:
编码猿
2024-09-27 01:01:17 +08:00
commit 14b8ae24fa
198 changed files with 22193 additions and 0 deletions

View File

@@ -0,0 +1 @@
11e03a6d-84be-4539-a4b3-5cd819ff4112

View File

@@ -0,0 +1,12 @@
http = require('http');
module.exports = function httpGet(url, callback) {
var buffer = '';
http.get(url, function(res) {
res.setEncoding('utf8');
res.on('data', (chunk) => buffer += chunk );
res.on('end', () => callback(res, buffer) );
});
};

View File

@@ -0,0 +1,18 @@
var http = require('http');
var URL = require('url');
module.exports = function httpPost(url, postData, callback) {
var options = URL.parse(url);
options.method = 'POST';
options.headers = { 'Content-Length': postData.length };
var req = http.request(options, (res) => {
var buffer = '';
res.setEncoding('utf8');
res.on('data', (chunk) => buffer += chunk);
res.on('end', () => callback(res, buffer));
});
req.write(postData);
req.end();
};