
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
wechat-parser
Advanced tools
解析微信推送的XML消息
/**
* 作为中间件使用
*/
var express = require('express');
var parser = require('wechat-parser');
// 默认为 false,可设置为 true,设置后所有消息对象的键名为小写
parser.lowercase(false);
// 默认为 false,设置后 req.weixin_xml 为原始XML字符串
parser.original('weixin_xml');
var app = express();
app.use(parser.middleware('weixin'));
app.use(function(req, res) {
console.log(req.weixin);
console.log(req.weixin_xml);
});
/**
* 直接调用
*/
app.use(function(req, res) {
parser.parse(req, function(err, message) {
if (err) throw err;
console.log(message);
});
});
wechatParser.middleware([body]);
传入可选参数body(String类型),返回解析微信推送消息的中间件函数。
wechatParser.parse(stream, callback);
传入数据流参数(这里一般为req对象),通过回调返回解析后的微信消息对象。回调函数包含err和message2个参数。
wechatParser.lowercase(bool)
可配置的布尔属性,默认为false,设置是否将将返回的消息对象的键名小写。
wechatParser.original(name)
将原始的XML字符串挂载到req请求对象上,默认为false,可设置为字符串。
FAQs
解析微信推送的XML消息
We found that wechat-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.