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
- Weird Query Error
In next js I am getting this error in the image ```js queries: [ Query.equal('title', TitleId), Query.limit(10) ] ``` am I doing something...
- Many2Many loading, not receiving list
Hi everyone! Im having a bit of trouble while editing single rows in the DB. When selecting a value of my many2many it keeps loading, see screenshot. On some ...
- SSR Auth with Tanstack Start requires ha...
I followed the Next.js guide for SSR Auth on https://appwrite.io/docs/tutorials/nextjs-ssr-auth/step-1 I tried to replicate it for Tanstack Start. However, on...