bakerstreet
bakerstreet
- Simple virtual file system and associated http server for embedding text files resources along with servers written in Crystal lang.
- In particular, supports : html, css, js and svg files.
- Does not support image files or binary files : jpeg, png, etc.
- For use in apps develpped using Crystal lang and WebView.
- The aim is portability of Crystal / Webview app between Linux, Mac and Windows 11.
Alpha version
Installation
-
Add the dependency to your
shard.yml
:dependencies: bakerstreet: github: serge-hulne/bakerstreet
-
Run
shards install
Usage
- The code for the examples is installed in the "lib" directory of your current project.
- In order to try the examples hereunder, you can copy the "public" directory from "./libs" to the root of your current project (along "./src")
require "bakerstreet"
See test_* files in ./src
Example 1 of use : Creating an embedded archive
require "bakerstreet"
bk = BakerStreetArchive.new("public")
bk.make_archive()
Example 2 of use : Using the embedded archive from example 1
require "../archive.cr"
require "bakerstreet"
bk = BakerStreetArchive.new("public")
arc = get_archive()
content = arc[bk.to_path("index.html")]
puts "file = #{content}"
Example 3 of use : Using the embedded archive from example 1 in a server
require "bakerstreet"
BakerStreetServer.serve(host="127.0.01", port=8080, debug=true)
TODO: Write usage instructions here
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/your-github-user/bakerstreet/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- serge - creator and maintainer
Repository
bakerstreet
Owner
Statistic
- 2
- 0
- 0
- 0
- 0
- over 1 year ago
- February 23, 2023
License
MIT License
Links
Synced at
Fri, 22 Nov 2024 06:40:26 GMT
Languages