
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
wechat-media
Advanced tools
注意: 该npm包需要依赖node后台模板中的 ../libs/utils.js 和 ../config.dev/serverConfig.json
var Wechat_media = require('wechat_media');
var company_id = "561f72fbe419be013b8b4zyx";
var option = {
url: media_url, //需要下载的资源url
name: filename, //要存储在本地的文件名
type: media_type, //文件类型,可以是"voice"或"image"
savePath: savePath //文件存储的相对路径
};
Wechat_media.download(company_id, option).then(function(ret){
if(ret.result){
var save_url = ret.data.media_url; //下载后的媒体文件可以访问的url地址,你必须首先在serverConfig中设置 static_url,这个将会是 static_url+option.name
var type = ret.data.type; //type为"voice"或"image"
var file = ret.data.file; //本地存储的文件地址
}else{
throw new Error("下载文件时出错");
}
}).catch(function(e){
console.log(e||e.stack);
})
var Wechat_media = require('wechat_media');
var company_id = "561f72fbe419be013b8b4zyx";
var option = {
media_url: media_url, //非必须参数,由download方法返回
file: filepath, //本地存储文件的地址
type: media_type //可以是"type"或"image"
};
Wechat_media.upload(company_id, option).then(function(ret){
if(ret.result){
var media_id = ret.data.media_id, //上传到微信后返回的media_id
}else{
throw new Error("上传文件时出错");
}
}).catch(function(e){
console.log(e||e.stack);
})
var Wechat_media = require('wechat_media');
var company_id = "561f72fbe419be013b8b4zyx";
var option = {
media_id: media_id, //要从微信获取的素材的media_id
name: filename, //要存储在本地的文件名
type: media_type, //文件类型,可以是"voice"或"image"
savePath: savePath //文件存储的相对路径
};
Wechat_media.saveMedia(company_id, option).then(function(ret){
if(ret.result){
var media_url = ret.data.media_url; //下载后的媒体文件可以访问的url地址,你必须首先在serverConfig中设置 static_url,这个将会是 static_url+option.name
var type = ret.data.type; //type为"voice"或"image"
var file = ret.data.file; //本地存储的文件地址
}else{
throw new Error("下载文件时出错");
}
}).catch(function(e){
console.log(e||e.stack);
})
$ npm install wechat-media
FAQs
manage wechat-enterprise media
We found that wechat-media 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.