mirror of
https://github.com/kou029w/websri.git
synced 2025-12-08 12:16:12 +00:00
A universal Subresource Integrity (SRI) utility for Node.js, browsers, Cloudflare Workers, Deno, Bun, and other web-compatible runtimes.
|
|
||
|---|---|---|
| .github/workflows | ||
| runtime | ||
| src | ||
| test | ||
| .gitignore | ||
| .release-it.json | ||
| CHANGELOG.md | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| renovate.json | ||
websri
websri is a universal Subresource Integrity (SRI) utility for Node.js, browsers, Cloudflare Workers, Deno, Bun, and other web-compatible runtimes.
Usage
Install package:
# npm
npm install websri
# yarn
yarn add websri
# pnpm
pnpm add websri
# deno
deno add npm:websri
# bun
bun add websri
import { createIntegrityMetadata } from "websri";
const res = new Response("Hello, world!");
const data = await res.arrayBuffer();
const integrityMetadata = await createIntegrityMetadata("sha256", data);
console.log(integrityMetadata.toString());
// sha256-MV9b23bQeMQ7isAGTkoBZGErH853yGk0W/yUx1iU7dM=
Documentation
FAQ
What is Subresource Integrity?
Subresource Integrity (SRI) is a security feature that allows user agents to verify that a fetched resource has not been manipulated unexpectedly.
License
websri is released under the MIT License.