Browse Source

hash: return file contents to avoid multiple syscalls and allocations

master
Guillermo Rauch 9 years ago
parent
commit
f9566f5dfa
  1. 6
      lib/hash.js

6
lib/hash.js

@ -9,9 +9,9 @@ import { readFile } from 'fs-promise';
*/
export default async function hashes (files) {
const entries = await Promise.all(files.map(async (file) => {
const data = await readFile(file);
return [hash(data), file];
const entries = await Promise.all(files.map(async (name) => {
const data = await readFile(name);
return [hash(data), { name, data }];
}));
return new Map(entries);
}

Loading…
Cancel
Save