Created
May 18, 2020 15:31
-
-
Save ogawa0071/efcc08e56021f99806702437030b9554 to your computer and use it in GitHub Desktop.
List all Google Cloud Storage files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fs from "fs"; | |
| import { Storage } from "@google-cloud/storage"; | |
| const storage = new Storage(); | |
| (async () => { | |
| const files = await storage | |
| .bucket("") | |
| .getFilesStream(); | |
| for await (const file of files) { | |
| const fileName = file.name; | |
| // console.log(fileName); | |
| await fs.promises.appendFile("files.txt", `${fileName}\n`); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment