Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luzifer/sri
Helper to calculate SRI information for `<link>` or `<script>` tags
https://github.com/luzifer/sri
golang sri utility
Last synced: 4 days ago
JSON representation
Helper to calculate SRI information for `<link>` or `<script>` tags
- Host: GitHub
- URL: https://github.com/luzifer/sri
- Owner: Luzifer
- License: unlicense
- Created: 2019-08-16T21:05:57.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T03:43:56.000Z (almost 2 years ago)
- Last Synced: 2024-10-30T23:16:55.503Z (about 2 months ago)
- Topics: golang, sri, utility
- Language: Go
- Size: 18.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
[![Go Report Card](https://goreportcard.com/badge/github.com/Luzifer/sri)](https://goreportcard.com/report/github.com/Luzifer/sri)
![](https://badges.fyi/github/license/Luzifer/sri)
![](https://badges.fyi/github/downloads/Luzifer/sri)
![](https://badges.fyi/github/latest-release/Luzifer/sri)
![](https://knut.in/project-status/sri)# Luzifer / sri
`sri` is a very small helper to calculate [SRI](https://www.w3.org/TR/SRI/) information for `` or `` tags.
Files are downloaded as they currently are and a checksum is calculated. This checksum then is printed inside the desired HTML tag for embedding into an HTML page.
Please be aware you should use this with non-changing URLs as the browser will no longer load the file as soon as the hash does no longer match.
## Usage
```console
# sri --help
Usage of sri:
--html Print HTML tags with SRI information (If disabled just prints the hashes) (default true)
--html-tag string Tag to use for HTML mode (supported: link, script) (default "link")
--log-level string Log level (debug, info, warn, error, fatal) (default "info")
--version Prints current version and exits# sri --html-tag link https://use.fontawesome.com/releases/v5.10.1/css/all.css
<link href="https://use.fontawesome.com/releases/v5.10.1/css/all.css" integrity="sha512-9my9Mb2+0YO+I4PUCSwUYO7sEK21Y0STBAiFEYoWtd2VzLEZZ4QARDrZ30hdM1GlioHJ8o8cWQiy8IAb1hy/Hg==" crossorigin="anonymous">
```