[ANN] EmbeddedStaticFiles.jl - Store your static assets, both locally and relocatably

Yes, this is not relocatable because the read happens inside a function. Try with the read happening at the top level into a global constant:

# Test package with sample.jpg
module MyPackage

export send_sample_file

include_dependency(joinpath(@__DIR__, "../sample.jpg"))
const SAMPLE_DATA = read(joinpath(@__DIR__, "../sample.jpg"))

function send_sample_file()
    SAMPLE_DATA
end

end
3 Likes