Skip to content

Instantly share code, notes, and snippets.

@vaaski
Created October 31, 2021 17:08
Show Gist options
  • Select an option

  • Save vaaski/c66e7e1a35968841942d2563a8500899 to your computer and use it in GitHub Desktop.

Select an option

Save vaaski/c66e7e1a35968841942d2563a8500899 to your computer and use it in GitHub Desktop.
deno create file hash
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