src/util/hash.js
async function hashes(files) {
  const map = new Map();

  await Promise.all(
    files.map(async name => {
      const data = await fs.promises.readFile(name);

      const h = hash(data);
      const entry = map.get(h);
      if (entry) {
        entry.names.push(name);
      } else {
        map.set(hash(data), { names: [name], data });
      }
    })
  );
  return map;
}
async function hashes(files) {
  const map = new Map();

  await Promise.all(
    files.map(async name => {
      const data = await fs.promises.readFile(name);

      const h = hash(data);
      const entry = map.get(h);
      if (entry) {
        entry.names.push(name);
      } else {
        map.set(hash(data), { names: [name], data });
      }
    })
  );
  return map;
}
async function hashes ( files ) { const map = new Map ( ) ; await Promise . all ( files . map ( async name => { const data = await fs . promises . readFile ( name ) ; const h = hash ( data ) ; const entry = map . get ( h ) ; if ( entry ) { entry . names . push ( name ) ; } else { map . set ( hash ( data ) , { names : [ name ] , data } ) ; } } ) ) ; return map ; }
Computes hashes for the contents of each file given.

@param {Array} of {String} full paths
@return {Map}
Computes hashes for the contents of each file given .