add 上传图片
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
const {spawn} = require('child_process');
|
||||
const path = require('path');
|
||||
const {cwd} = require('process');
|
||||
|
||||
const {readFile} = require("fs");
|
||||
const {post} = require("axios");
|
||||
|
||||
function seep(time) {
|
||||
return new Promise((res) => {
|
||||
@@ -11,6 +12,23 @@ function seep(time) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图片至图床 (暂不可用)
|
||||
* @param filePath 图片路径
|
||||
*/
|
||||
function uploadImg(filePath) {
|
||||
|
||||
readFile(filePath, function (err, data) {
|
||||
let formData = new FormData()
|
||||
formData.append('file', data)
|
||||
post('https://image.zmpt.cc/upload/localhost', formData).then((response, headers) => {
|
||||
console.info(response)
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取腾讯视频播放列表
|
||||
* @param {String}cid 视频id
|
||||
@@ -148,5 +166,6 @@ module.exports = {
|
||||
getVideoSpecifyTimeImage,
|
||||
getMediaInfo,
|
||||
createTorrent,
|
||||
getTencentVideoPlayList
|
||||
getTencentVideoPlayList,
|
||||
uploadImg
|
||||
}
|
||||
Reference in New Issue
Block a user