Skip to content

Instantly share code, notes, and snippets.

@benji6
Created December 27, 2018 20:41
Show Gist options
  • 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