Skip to content

Instantly share code, notes, and snippets.

@benji6
Created December 27, 2018 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benji6/9c3ee508ff52b40f2aaa53c5feff0baf to your computer and use it in GitHub Desktop.
Save benji6/9c3ee508ff52b40f2aaa53c5feff0baf to your computer and use it in GitHub Desktop.
Compute cache busting hash
const crypto = require('crypto')
const computeHash = data =>
crypto
.createHash('md5')
.update(data)
.digest('base64')
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=+$/, '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment