Skip to content

Instantly share code, notes, and snippets.

@necccc
Created January 26, 2018 20:45
Show Gist options
  • Save necccc/9f2594c8a5a2c9247f5de9e3800a619a to your computer and use it in GitHub Desktop.
Save necccc/9f2594c8a5a2c9247f5de9e3800a619a to your computer and use it in GitHub Desktop.
random 1024 bytes of binary data
const crypto = require('crypto')
const fs = require('fs')
const util = require('util')
const writeFile = util.promisify(fs.writeFile)
const randomBytes = util.promisify(crypto.randomBytes)
void async function () {
const data = await randomBytes(1024)
writeFile('./random1024.bin', data)
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment