mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-07-04 14:19:19 +00:00
优化
This commit is contained in:
parent
924f818a1f
commit
c83abd270b
@ -225,7 +225,15 @@ export class xzq extends plugin {
|
|||||||
return !!res;
|
return !!res;
|
||||||
*/
|
*/
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
|
if (!fs.existsSync(filePath)) {
|
||||||
|
logger.error(`文件不存在:${filePath}`);
|
||||||
|
e.reply(`文件上传失败`, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const fileStream = fs.createReadStream(filePath);
|
const fileStream = fs.createReadStream(filePath);
|
||||||
|
fileStream.on('error', (err) => {
|
||||||
|
logger.error('文件读取错误:', err);
|
||||||
|
});
|
||||||
form.append('file', fileStream);
|
form.append('file', fileStream);
|
||||||
form.append('token', configControl.get('coreConfig')?.token);
|
form.append('token', configControl.get('coreConfig')?.token);
|
||||||
const uploadUrl = `${configControl.get('coreConfig')?.coreUrl}/public/upload?dir=fanqie&expire=600`;
|
const uploadUrl = `${configControl.get('coreConfig')?.coreUrl}/public/upload?dir=fanqie&expire=600`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user