databio / simpleCache

Simplified R caching for reproducible big data projects
http://code.databio.org/simpleCache/
Other
34 stars 6 forks source link

Download caching function? #40

Open koheiw opened 6 years ago

koheiw commented 6 years ago

I had download() function in the readtext package, whose primary function is to save downloaded files locally as cache files to avoid downloading of the same files.

However, I decided to move that function to somewhere else because the function is not specifically about textual data. The new home for the function can be a new single function package downloadCache, but, before start making the package, I want to know if you have a plan to add a similar function to simpleCache.

I am also happy to issue a PR if you think that function fits well to your package.

nsheff commented 6 years ago

There actually was once such a function in simpleCache:

https://github.com/databio/simpleCache/commit/cff17432d9aa16128914870aa57ed1c42fba964d

I removed it because I never had it 100% working and I didn't want to have non-working cruft in the release package when we submitted to CRAN.

So, I would welcome a PR with a fully functional version of that function. I have a few thoughts first about how it would work:

koheiw commented 6 years ago

Hi @nsheff interesting to hear about the history of the package. I was thinking to use simpleCache as underlying caching function, and define a special behavior for a URL to that function makes sense. As for the file types, I had the same problem in readtext, but made the function to return path to cached file instead of file content so that appropriate IO function can be used. If it does not sound good, we could limit the supported file types to either RDS or RDA.