列出 Google Cloud Storage 存储桶中特定时间戳之后更改的文件

use*_*835 5 java node.js google-cloud-storage google-cloud-platform google-cloud-functions

我想列出在 node.js 中的特定时间戳之后已更改/添加到 Google 云存储桶中的文件。我正在查看文档https://cloud.google.com/storage/docs/how-to但没有找到任何机制。

const {Storage} = require('@google-cloud/storage');
const storage = new Storage();
const bucketName = 'my-bucket';
const [files] = await storage.bucket(bucketName).getFiles();
Run Code Online (Sandbox Code Playgroud)

如何列出存储桶中时间戳之后添加的文件?

Dou*_*son 3

对于给定的list API来说这似乎是不可能的。该文档没有提及任何有关使用日期过滤对象的内容。

将所有上传文件的数据存储在数据库中是很常见的,这样可以更轻松地查询要存储的文件的任何属性。您甚至可以使用 Cloud Functions 触发器为每个文件上传自动将记录写入数据库。