3 ms·
Do you have a link to your code? I thought fs.FS is read-only, so I’m curious where/how you bring writing data into it (“copies from folder A to folder B”)? Or
by secure 4y ago
Do you have a link to your code? I thought fs.FS is read-only, so I’m curious where/how you bring writing data into it (“copies from folder A to folder B”)? Or do you mean that your implementation of fs.FS generates the content on-demand, when net/http serves it?
- nhanb 4y ago> Or do you mean that your implementation of fs.FS generates the content on-demand, when net/http serves it? It's closer to this. The actual content was already written to an sqlite db, and my read-only FS allows reading that data back out but as a filesystem. The admittedly not that interesting (and probably bad - I'm new to Go) code is here[1], and this "BlogFS" is used in 2 places: - During "export" where it generates the static site. "Folder A" is my FS and "Folder B" is the destination i.e. an actual folder on the real filesystem. - In a preview server that just serves "Folder A" directly. [1]: https://git.sr.ht/~nhanb/bloghead/tree/40b70cadb01c14f1e3bf5191421828061d432204/item/blogfs/blogfs.go https://git.sr.ht/~nhanb/bloghead/tree/40b70cadb01c14f1e3bf5...