There’s a function in DataDeps I’ve used which does this https://github.com/oxinabox/DataDeps.jl/blob/master/src/post_fetch_helpers.jl
I use it in my package here for a zip file: https://github.com/aaowens/PSID.jl/blob/e4115cd0cd9cc0afc7fad1e64d82c808dd64e756/src/unzip_data.jl#L66