Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Google Drive API:列出特定文件夹中的文件_Node.js_Google Drive Api - Fatal编程技术网

Node.js Google Drive API:列出特定文件夹中的文件

Node.js Google Drive API:列出特定文件夹中的文件,node.js,google-drive-api,Node.js,Google Drive Api,我需要列出驱动器特定文件夹中的所有文件。它正在工作,但并不像预期的那样。 即使文件已被删除并放置在垃圾箱中,我也会获得此文件夹中的所有文件列表 我如何才能只获取真正在此文件夹中的文件 异步listActiveSeries() { 设_RESULT=null; 尝试 { const auth=等待此消息。_makeClient(); const googleDriveClient=google.drive({version:'v3',auth}); const response=wait goog

我需要列出驱动器特定文件夹中的所有文件。它正在工作,但并不像预期的那样。 即使文件已被删除并放置在垃圾箱中,我也会获得此文件夹中的所有文件列表

我如何才能只获取真正在此文件夹中的文件

异步listActiveSeries()
{
设_RESULT=null;
尝试
{
const auth=等待此消息。_makeClient();
const googleDriveClient=google.drive({version:'v3',auth});
const response=wait googleDriveClient.files.list
({
页面大小:150,
问:家长中的“${ID\u OF_THE_FOLDER}”`
});
if(response&&response.data&&response.data.files)
{
_结果=response.data.files;
}
}
捕获(ex)
{console.log(ex);}
返回结果;
}

我相信你的目标如下

  • 您希望仅检索特定文件夹中的文件列表
  • 您不想将文件包括在垃圾箱中
在这种情况下,如何使用
trashed=false
进行搜索查询?当您的脚本被修改时,它将变成如下所示

发件人: 致:
  • 通过将
    trashed=false
    添加为
    ,不会检索垃圾箱中的文件
参考:
q: `'${ID_OF_THE_FOLDER}' in parents`
q: `'${ID_OF_THE_FOLDER}' in parents and trashed=false`