🧀 将图片上传至公共CDN的工具
🧀 将图片上传至公共CDN的工具
JavaScript 文件上传
共59Star
详细介绍
Usage
Installation
npm install upimg
or
yarn add upimg
Require module
const upimg = require('upimg')
Support servers
server | endpoint | cookie | url |
---|---|---|---|
alibaba | aliexpress | - | ae01.alicdn.com |
jd | 京东 | - | img14.360buyimg.com |
netease | 网易严选 | - | yanxuan.nosdn.127.net |
qihoo | 360搜索 | - | ps.ssl.qhmsg.com |
smms | smms | - | i.loli.net |
sogou | 搜狗识图 | - | img04.sogoucdn.com |
xitu | 掘金 | - | user-gold-cdn.xitu.io |
panda | 熊猫直播 | require | i.h2.pdim.gs |
qcloud | 云+社区 | require | ask.qcloudimg.com |
微博 | require | wx1.sinaimg.cn |
Upload file
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"
}
}
Author
upimg © metowolf, Released under the MIT License.
Blog @meto · GitHub @metowolf · Twitter @metowolf · Telegram Channel @metooooo