JVM - bucket.files()

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

import io.nitric.Nitric;
import io.nitric.resources.BucketPermission;

public class Application {
  public static void main(String[] args) {
    var bucket = Nitric.INSTANCE.bucket("images").with(BucketPermission.Read);

    var files = bucket.files();

    Nitric.INSTANCE.run();
  }
}

Examples

Deleting all files in a bucket.

import io.nitric.Nitric;
import io.nitric.resources.BucketPermission;

public class Application {
  public static void main(String[] args) {
    var bucket = Nitric.INSTANCE.bucket("bucket").with(BucketPermission.Read);

    var files = bucket.files();

    files.forEach((file) -> file.delete());

    Nitric.INSTANCE.run();
  }
}

Notes

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