Node.js - bucket.files()

Get a list of file references for files that exist in the bucket.

import { bucket } from '@nitric/sdk'

const assets = bucket('assets').allow('read')

const files = await assets.files()

Examples

Deleting all files in a bucket

import { bucket } from '@nitric/sdk'

const assets = bucket('assets').allow('delete')

const files = await assets.files()
await Promise.all(files.map(async (file) => await file.delete()))

Notes

This method returns a list of File references that exist on the bucket.