I want to read file which i have added in my cloud function what is the path in cloud so I can access it
if (request.path == "/read_proto") {
// Define the path to your .proto file
String filePath = '${io.Directory.current.path}/protos/test.proto';
try {
// Read the file as text
String content = io.File(filePath).readAsStringSync();
return response.json({
'path': request.path,
'proto': content,
});
} catch (e) {
return response.json({
'path': request.path,
'error': e.toString(),
});
}
}
"error": "PathNotFoundException: Cannot open file, path = '/usr/local/server/protos/test.proto' (OS Error: No such file or directory, errno = 2)"
I have dart function in following structure
dart_func
- lib/
- protos/
Cannot open file, path = '/usr/local/server/protos/test.proto
You won't be able to do this with go because your code is compiled and only the compiled binary is deployed
I show below function which is mention in templates
https://github.com/appwrite/templates/blob/main/dart/whatsapp_with_vonage/lib/utils.dart
I tried this way and got this error
"error": "PathNotFoundException: Cannot open file, path = '/usr/local/server/src/function/../protos/test.proto' (OS Error: No such file or directory, errno = 2)"
final protosFolder =
p.join(p.dirname(io.Platform.script.toFilePath()), '../protos');
final protosFilePath = p.join(protosFolder, "test.proto");
// Read the file as text
String content = io.File(protosFilePath).readAsStringSync();
Sorry I don't think that works
with go?
Sorry same with dart. Dart is also compiled
Okay, Thank you for your time.
I have one question, if I upload file in storage is there any way I can make it publically so I don't need to authenticate for file
https://cloud.appwrite.io/v1/storage/buckets/67cb873900041825c482/files/67cb877300353e5b4122/view?project=67ae34c00007ef221886&mode=admin
Sure. Configure the permissions for the bucket and possibly file
Yeah, I just figured it out. Thanks
For function, will it have support in future for read/add temp file when we deploy function?
Recommended threads
- [Solved] Appwrite project paused
I have github student account. The auth has been paused however the database is working fine. I cant see any option to resume from my console panel. It is just ...
- Missing Invoice
Hi! I need help with billing on my account (marelu@gmail.com). I have never received a single invoice by email. My organization has been on the Pro plan since...
- Appwrite Functions cold start
Hello. I'm seeing really long cold starts on Appwrite Cloud Functions and wanted to know if this is expected. My function just authenticates the user, fetches ...