Documentation
¶
Overview ¶
Package example provides an example HTTP server for showing how hashfs is implemented and the results you can inspect.
Simply run with go run example.com and open a browser to localhost:8080.
Implementation of HashFS:
- Your source files are read via embed.FS.
- Your static files are provided to hashfs.NewFS.
- You define a func (see static below) to rewrite your URLs from the original name to the name generated by hashfs based on each file's contents.
- You modify your your HTML templates to use the defined func for each static file. see {{static ...}} in website/templates/index.html.
- When your HTML templates are parsed, the defined func rewrites the URLs to each static file to include a hash of each file's contents.
Click to show internal directories.
Click to hide internal directories.