uploadWithBytes method
Uploads the data specified in uploadFileByte
to remoteRelativePathOrId
, which is the location on the remote side.
The byte data of the file is passed to uploadFileByte
and the relative path is passed to remoteRelativePathOrId
.
Return RemoteFile
containing the full path of the upload destination and the actual data as the return value.
uploadFileByte
で指定されたデータをリモート側の位置であるのremoteRelativePathOrId
にアップロードします。
uploadFileByte
にファイルのバイトデータが渡されremoteRelativePathOrId
に相対パスが渡されます。
戻り値としてアップロード先のフルパスと実データを格納したRemoteFile
を返してください。
Implementation
@override
Future<RemoteFile> uploadWithBytes(
Uint8List uploadFileByte,
String remoteRelativePathOrId,
) async {
final remoteFullPath = await remoteStorage.fetchURI(remoteRelativePathOrId);
if (await remoteStorage.exists(remoteFullPath)) {
await remoteStorage.delete(remoteFullPath);
}
await remoteStorage.write(remoteFullPath, uploadFileByte);
return RemoteFile(
path: await fetchPublicURI(remoteFullPath),
bytes: uploadFileByte,
);
}