node-mac-contacts
node-mac-contacts copied to clipboard
Get contact image by id
https://github.com/KishanBagaria/node-mac-contacts/commit/e2e1f1250e6107e361734bfd6d3a0ee6aa12c927
Can create a PR if you'd like to merge upstream - might need a review
Out of curiosity - what's the perf difference between this and just fetching the contact by id and pulling the single property off it?
~~There's no fetch contact by id method exposed by node-mac-contacts?~~ I think a more generic and useful function here would be fetchContact(identifier: string, keys: string[]) which only fetches the keys specified.
Edit: if you meant just fetching thumbnailImageData or just imageData compared to the smaller-of-the-two check I'm doing here -- that's definitely implementation specific I agree and probably not a clean design for nmc. Perf benefit is substantial (either of them could be 10-100x bigger than the other.)
I was pre-fetching all contact images with getAllContacts earlier but that loads hundreds of megabytes of image data in memory for some people, so lazy loading now when needed.
@KishanBagaria ah yeah sorry
I was pre-fetching all contact images with getAllContacts earlier but that loads hundreds of megabytes of image data in memory for some people, so lazy loading now when needed.
this is what i was (poorly lol) referring to. That sounds good as an abstraction - i'll poke at this a bit but feel free to open a PR and i'll take a look when i can! I'm in the middle of an international move this week though so no promises on timeline 😅