utils.js 257 B

1234567891011121314
  1. const crypto = require('crypto');
  2. function sleep(ms) {
  3. return new Promise(resolve => setTimeout(resolve, ms));
  4. }
  5. function randomHexString(len) {
  6. return crypto.randomBytes(len).toString('hex')
  7. }
  8. module.exports = {
  9. sleep,
  10. randomHexString
  11. };