-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
28 lines (22 loc) · 601 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import emojify from './emojify.js'
import crypto from 'crypto'
import readline from 'readline'
console.log('Type something in to generate it\'s sha256 hash and an emoji representation of that.')
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
prompt: 'toSha256ToEmoji> '
})
rl.prompt()
rl.on('line', (line) => {
const hash = crypto.createHash('sha256').update(line.trim()).digest('hex')
const emojis = emojify(hash)
console.log(
hash,
emojis
)
rl.prompt()
}).on('close', () => {
console.log('Have a great day!')
process.exit(0)
})