mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
993 B
993 B
hash-file
Instructions
Create a function hashFile(fpath)
that given the name of a file in the current folder, expected to be a string, returns the hash sha256
of the content of this file as a string.
Here an example on how you should make your function used from external scripts:
exports.hasFile = ...
Usage
Here below an example of main.js
script to test the usage of the hashFile
function:
const hash = await hashFile('textfile.txt')
console.log(hash)
And its usage:
$ cat textfile.txt
Sometimes science is more art than science.$
Sometimes science is more art than science.
$ node main.js
bd9ecabfb0c9a310cbca5ef1dd6456486236ba58a1d8a4eaf2b0a40283525cd9
$