Created
October 31, 2021 17:08
-
-
Save vaaski/c66e7e1a35968841942d2563a8500899 to your computer and use it in GitHub Desktop.
deno create file hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const createHash = async (filename: string) => { | |
| const file = await Deno.readFile(filename) | |
| const hash = await crypto.subtle.digest("SHA-1", file) | |
| const hashArray = Array.from(new Uint8Array(hash)) | |
| return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment