且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用NodeJS和Google Drive API v3将文件移至回收站

更新时间:2023-02-14 13:04:38

我相信您的情况和目标如下.

I believe your situation and goal as follows.

  • 您要使用带有Node.js的googleapis的Drive API v3将文件移至垃圾箱.
  • drive 可以用于使用Drive API的文件:更新"方法.
  • You want to move a file to the trash box using Drive API v3 with googleapis with Node.js.
  • drive can be used for using the method of "Files: update" of Drive API.

为此,该修改如何?在这种情况下,请将请求正文包含在 requestBody resource 中,如下所示.

For this, how about this modification? In this case, please include the request body to requestBody or resource as follows.

await drive.files.update({ fileId, requestBody: { trashed: true } });

await drive.files.update({ fileId, resource: { trashed: true } });

参考文献: