Update top JS snippets
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
title: hashNode
|
||||
tags: node,promise,advanced
|
||||
firstSeen: 2018-01-17T14:09:01+02:00
|
||||
lastUpdated: 2020-10-19T22:30:46+03:00
|
||||
lastUpdated: 2021-10-13T19:29:39+02:00
|
||||
---
|
||||
|
||||
Creates a hash for a value using the [SHA-256](https://en.wikipedia.org/wiki/SHA-2) algorithm.
|
||||
@ -10,7 +10,7 @@ Returns a promise.
|
||||
|
||||
- Use `crypto.createHash()` to create a `Hash` object with the appropriate algorithm.
|
||||
- Use `hash.update()` to add the data from `val` to the `Hash`, `hash.digest()` to calculate the digest of the data.
|
||||
- Use `setTimeout()` to prevent blocking on a long operation, and return a `Promise` to give it a familiar interface.
|
||||
- Use `setTimeout()` to prevent blocking on a long operation. Return a `Promise` to give it a familiar interface.
|
||||
|
||||
```js
|
||||
const crypto = require('crypto');
|
||||
|
||||
Reference in New Issue
Block a user