dodo / node-unicodetable

unicode lookup table
MIT License
42 stars 34 forks source link

Cache unicodeData.txt #18

Open oliversalzburg opened 9 years ago

oliversalzburg commented 9 years ago

When installing packages that rely on this packages on Windows, the data will be pulled from unicode.org every single time the package is installed.

Not only is there no directory in systemfiles that would fit a Windows environment, the data that is retrieved isn't cached either :(

dodo commented 9 years ago

Since i don't have a windows system, i'm unsure how to solve this issue. The txt file could be written to a globally accessable space (like ~/.cache under linux), but i'm not sure if that would solve the problem or just simply create new ones.

Would you mind creating a pull request?

oliversalzburg commented 9 years ago

@dodo I'll look into how the process works and submit a suggestion :)

oliversalzburg commented 9 years ago

I would assume that using ~/.cache is a viable option. Combined with home-dir, it should work cross-platform.

A possible problem that came to mind was, that the cached data could get outdated and that would impact future installations of node-unicodetable, but the same is true for existing approaches that reference files in /usr/share.

However, I could see how caching in that location might lead to unexpected results. Someone might reinstall node-unicodetable and be confused why the data isn't updated, because they weren't aware of this cache. This is less likely to happen with data that is pulled from official packages for the distribution.

I'd still consider it beneficial if something like ~/.cache/unicodetable/UnicodeData.txt was checked for existing data. That way, someone might place the file there manually.

I'm aware of the ability to set an environment variable to point to any location you wish, but I personally wouldn't want to constantly have a variable in my environment that is only relevant when I install this package.

zenlambda commented 8 years ago

I've noticed that OS X El Capitan doesn't include UnicodeData.txt in /usr/share/unicode/ or /usr/share/unicode-data/, so the postinstall phase will pull from unicode.org every single time just like Windows.

I can't even put the file there without disabling system integrity protection. 🙁

GFoley83 commented 7 years ago

@dodo Are you still supporting this repo? There's 6 open issues relating to not being able to install UnicodeData.txt due to external constraints (e.g. corporate environments, proxies, firewalls etc).

Is there any way you could just include UnicodeData.txt so that is comes with the module at install time?