Storage

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').for('reading');

const files = await assets.files();

Examples

Deleting all files in a bucket

import { bucket } from '@nitric/sdk';

const assets = bucket('assets').for('reading');

const files = await assets.files();

await Promise.all(files.forEach(async (file) => await file.delete()));

Notes

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