
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
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
The npm package wechat_media receives a total of 3 weekly downloads. As such, wechat_media popularity was classified as not popular.
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
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.