diff --git a/Project.toml b/Project.toml index d143677..1390093 100644 --- a/Project.toml +++ b/Project.toml @@ -1,12 +1,18 @@ name = "FileIO" uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" -version = "1.16.5" +version = "1.16.6" [deps] Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Requires = "ae029012-a4dd-5104-9daa-d747884805df" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +[weakdeps] +HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" + +[extensions] +HTTPExt = "HTTP" + [compat] Pkg = "<0.0.1, 0.7, 1" Requires = "1" diff --git a/docs/Project.toml b/docs/Project.toml index 8498d31..502ec74 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -6,4 +6,4 @@ PNGFiles = "f57f5aa1-a3ce-4bc8-8ab9-96f992907883" [compat] Documenter = "1" -HTTP = "0.9" +HTTP = "0.9, 1" diff --git a/ext/HTTPExt.jl b/ext/HTTPExt.jl new file mode 100644 index 0000000..ff64e12 --- /dev/null +++ b/ext/HTTPExt.jl @@ -0,0 +1,13 @@ +module HTTPExt + +if isdefined(Base, :get_extension) + using FileIO + using HTTP +else + using ..FileIO + using ..HTTP +end + +FileIO.load(uri::HTTP.URI) = load(IOBuffer(HTTP.get(uri).body)) + +end # module \ No newline at end of file diff --git a/src/FileIO.jl b/src/FileIO.jl index b4a555c..bda6bab 100644 --- a/src/FileIO.jl +++ b/src/FileIO.jl @@ -64,11 +64,13 @@ include("registry.jl") """ FileIO +@static if !isdefined(Base, :get_extension) function __init__() @require HTTP="cd3eb016-35fb-5094-929b-558a96fad6f3" begin - load(uri::HTTP.URI) = load(IOBuffer(HTTP.get(uri).body)) + include("../ext/HTTPExt.jl") end end +end # @static if VERSION >= v"1.4.2" # https://github.com/JuliaLang/julia/pull/35378 include("precompile.jl")