minor optimization nit but you could just do numFiles = object.keys(searchResults).length before the forEach. instead of bumping a counter by one on each iteration.