Make it easier for functions to access other files in their folder
See original GitHub issueThis came from internal Yammer group.
If a function folder contains a data.txt
file, it is currently difficult to read that file from the function code. Typically, common patterns to do this would be:
- Rely on the current folder being set to the function folder as it runs
- Rely on some environment variable pointing to the function folder
Unfortunately, these can’t work today since all functions run in the same process. We need to come up with an approach to solve this.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:21 (10 by maintainers)
Top Results From Across the Web
How to organize files and folders
Start organizing your files by creating a logical, hierarchical folder structure. The best folder structure will mimic the way you work. For ...
Read more >Windows Basics: Working with Files
You can view and organize files and folders using a built-in application known as File Explorer (called Windows Explorer in Windows 7 and...
Read more >python - Importing files from different folder
From what I know, add an __init__.py file directly in the folder of the functions you want to import will do the job....
Read more >Access documents and other files from shared storage
Quickly bring your app to life with less code, using a modern declarative approach to UI, and the simplicity of Kotlin. ... Start...
Read more >Python Write to File – Open, Read, Append, and Other ...
One of the most important functions that you will need to use as you work with files in Python is open() , a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@abergs See here for a sample that does that.
The properties on the ExecutionContext are very helpful for C# projects. But I have another question/feature request:
I have some static files as part of my project (custom encoder presets stored as json or xml, etc) that I want to File.Read() into my function at runtime. Given that C# now uses attributes instead of folders, I keep all of my individual functions as .cs files in the root of my project along side the static files. ExecutionContext.FunctionDirectory only has function.json in it, and if i …/ up one level, my project-level static files are not in that folder. It turns out that they are in …/bin/ relative to the function folder.
However, when running the project locally using the VS Tools, the project .dlls and other output are not in a ‘bin’ subfolder but at the root of the output directory. So I cant reference the file using the same path locally and when deployed.
PROJECT -MyFunction1.cs -MyFunction2.cs -SomeOtherFile.json
How can I reference SomeOtherFile.json from my function both locally and when deployed?