Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get contact image by id #19

Open
KishanBagaria opened this issue Mar 4, 2021 · 3 comments
Open

Get contact image by id #19

KishanBagaria opened this issue Mar 4, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@KishanBagaria
Copy link
Contributor

TextsHQ@e2e1f12

Can create a PR if you'd like to merge upstream - might need a review

@codebytere
Copy link
Owner

Out of curiosity - what's the perf difference between this and just fetching the contact by id and pulling the single property off it?

@codebytere codebytere added the enhancement New feature or request label Mar 5, 2021
@KishanBagaria
Copy link
Contributor Author

KishanBagaria commented Mar 5, 2021

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.

@codebytere
Copy link
Owner

@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 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants