storeFile method
Store a file in the cloud storage. storageId
is typically 'public' or
'private'. The public storage can be accessed through a public URL. The
file is stored at the path
relative to the cloud storage root directory,
if a file already exists it will be replaced.
Implementation
Future<void> storeFile({
required String storageId,
required String path,
required ByteData byteData,
DateTime? expiration,
}) async {
var storage = _session.server.serverpod.storage[storageId];
if (storage == null) {
throw CloudStorageException('Storage $storageId is not registered');
}
await storage.storeFile(session: _session, path: path, byteData: byteData);
}