function number2Bytes(i) { var arr = new Int32Array(1); arr[0] = 0; var buf = Buffer.from(arr.buffer, 'hex'); buf.writeInt32BE(i); console.log("buf:", buf); console.log("buffer length :", buf.length); var iNumber = buf.readInt32BE(); c
Nodejs Http发送post请求 var http = require('http'); function epay(params) { console.log(" COME IN"); var params = JSON.stringify({ "sign":"ExdYcut6LgrKGsHuAyoxFTMDuDYVmyFFu7GRHPRwB/DBwm6cyBe9Sr2rti1/SjWPcdXLoWIHWEJ9IFKPK+3ieKU/MkNqeh
var util = require('util'); var evem = require('events').EventEmitter; function myem(){ evem.call(this); } util.inherits(myem, evem); var em = new myem(); em.on('msg',function(data){ console.log('接收到消息:'+data); }) em.emit('msg','l am coming!')