Should this be a shard? A BakedFileHandler for Kemal

It’s what it says in the topic: a thing that lets you serve files baked into the binary using Kemal.

I wrote it for myself and it’s small, but it may be useful in general? Not sure.

Code is here: grafito/src/baked_handler.cr at main · ralsina/grafito · GitHub

2 Likes

Seems useful, I’d say deserves a shard of its’ own.

1 Like

There you go

There’s also GitHub - schovi/baked_file_system: Virtual File System for Crystal language. Embedding your assets into final binary.

It uses that, this is just the kemal side :-)

1 Like

Yes, it really useful, just because there is no this shard, I have to write a naive one myself (need mount to disk before use it)

@ralsina , Hi, you need add backed_file_system as dependency in your shard.

BTW: do you consider update tartrazine’s backed_file_system dependency to use original shard?

Error shard name (baked_file_system) has ambiguous sources: 

'git: https://github.com/schovi/baked_file_system.git' and 

'git: https://github.com/ralsina/baked_file_system.git'.

I guess you need update the shard.yml for both sixteen and tartrazine.

1 Like

I can do it eventually. I hate that I need to pass an option to make it not-broken.

Nah, latest upstream version doesn’t build:

In lib/baked_file_system/src/loader/loader.cr:15:25

 15 | elsif !File::Info.readable?(root_path)
                        ^--------
Error: undefined method 'readable?' for File::Info.class

Why you get this error? there is a .readable? method in File::Info

No idea, not debugging it.