createStorageByBytes method
透過位元建立檔案儲存,如果建立成功將返回檔案儲存資訊
Implementation
Future<Storage> createStorageByBytes(Uint8List bytes) async {
APIHttpResponse response =
await httpClient.post('/storage/create', body: bytes, headers: {
'Content-Type': 'application/octet-stream',
});
if (bytes.lengthInBytes > (8 * 1024 * 1024)) {
// 檔案最大只能上傳 8 MB
throw Exception('File size is too large');
}
return Storage.fromMap(response.data);
}