Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add internal kernel API /api/file/globalCopyFiles #10614

Closed
WingDr opened this issue Mar 15, 2024 · 1 comment
Closed

Add internal kernel API /api/file/globalCopyFiles #10614

WingDr opened this issue Mar 15, 2024 · 1 comment
Assignees
Milestone

Comments

@WingDr
Copy link

WingDr commented Mar 15, 2024

插件无法使用 putFile API 通过文件路径上传文件

In what scenarios do you need this feature?

在插件中需要上传一些资源文件,目前的方法是用fs.copyFile,但是D大表示这样的操作可能会导致数据分块损坏。在研究了一下putFile这个API之后,发现js无法直接根据文件路径形成form-data中的文件。

Describe the optimal solution

希望能够只提供文件的绝对路径(工作空间外),然后后端进行上传操作

Describe the candidate solution

No response

Other information

No response

@88250 88250 self-assigned this Mar 18, 2024
@88250 88250 changed the title 插件无法使用 putFile API 通过文件路径上传文件 Add internal kernel API /api/file/globalCopyFiles Mar 18, 2024
@88250 88250 added this to the 3.0.4 milestone Mar 18, 2024
@88250
Copy link
Member

88250 commented Mar 18, 2024

/api/file/globalCopyFiles

参数:

{
    "srcs": ["C:\\Users\\User1\\Desktop\\444.log", "C:\\Users\\User1\\Desktop\\123.pdf", "C:\\Users\\User1\\Desktop\\siyuan\\"],
    "destDir": "/data/assets/"
}
  • srcs:源文件绝对路径,支持文件夹
  • destDir:相对于工作空间的路径

返回:

{
    "code": 0,
    "msg": "",
    "data": null
}

报错的话 code 不为 0。

@88250 88250 closed this as completed Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants