npm install upimg
or
yarn add upimg
const upimg = require('upimg')
server | endpoint | cookie | url |
---|---|---|---|
alibaba | aliexpress | - | ae01.alicdn.com |
jd | 京东 | - | img14.360buyimg.com |
netease | 网易严选 | - | yanxuan.nosdn.127.net |
smms | smms | - | i.loli.net |
suning | 苏宁易购 | - | image.suning.cn |
xiaomi | 小米有品 | - | shop.io.mi-img.com |
xitu | 掘金 | - | user-gold-cdn.xitu.io |
panda | 熊猫直播 | require | i.h2.pdim.gs |
qcloud | 云+社区 | require | ask.qcloudimg.com |
微博 | require | wx1.sinaimg.cn |
for chinese users: 由于某公司方面施压,upimg 将不维护以上列表外服务的可用性
take alibaba
for example
upimg.alibaba
.upload('./test/nodejs.png')
.then(json => console.log(json))
.catch(err => console.error(err.message))
success response
{
"url": "https://ae01.alicdn.com/kf/HTB1dYeZXZrrK1RjSspa763REXXaP.png",
"type": {
"ext": "png",
"mime": "image/png"
}
}
take panda
for cookies required example
upimg.panda
.cookie('foo=bar; xxx=123')
.upload('./test/nodejs.png')
.then(json => console.log(json))
.catch(err => console.error(err.message))
success response
{
"url": "https://i.h2.pdim.gs/601628d09da962bb7ae33344d1529303.png",
"type": {
"ext": "png",
"mime": "image/png"
}
}
upimg © metowolf, Released under the MIT License.
Blog @meto · GitHub @metowolf · Twitter @metowolf · Telegram Channel @metooooo