Download this file
| 1 | package www |
| 2 | |
| 3 | import ( |
| 4 | "io/fs" |
| 5 | "testing/fstest" |
| 6 | ) |
| 7 | |
| 8 | // FS presents a tree Pages returned as a file system, so site.Build |
| 9 | // can take it where it takes a directory. Every entry is a regular |
| 10 | // file with mode 0644, the mode cmd/fiesta writes files with, and |
| 11 | // the directories between are implied by the paths. |
| 12 | func FS(m map[string][]byte) fs.FS { |
| 13 | out := make(fstest.MapFS, len(m)) |
| 14 | for name, data := range m { |
| 15 | out[name] = &fstest.MapFile{Data: data, Mode: 0o644} |
| 16 | } |
| 17 | return out |
| 18 | } |
| 19 | |