Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukaskalbertodt/reinda
Easily embed and manage assets for your web application to build standalone-executables. Offers filename hashing, templating and more.
https://github.com/lukaskalbertodt/reinda
assets backend caching embed hash rust standalone-executables webdevelopment
Last synced: 4 days ago
JSON representation
Easily embed and manage assets for your web application to build standalone-executables. Offers filename hashing, templating and more.
- Host: GitHub
- URL: https://github.com/lukaskalbertodt/reinda
- Owner: LukasKalbertodt
- License: apache-2.0
- Created: 2021-01-20T21:49:55.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-14T20:18:42.000Z (3 months ago)
- Last Synced: 2024-10-19T14:01:12.601Z (26 days ago)
- Topics: assets, backend, caching, embed, hash, rust, standalone-executables, webdevelopment
- Language: Rust
- Homepage:
- Size: 207 KB
- Stars: 32
- Watchers: 3
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# `reinda`: easily embed and manage assets
[](https://github.com/LukasKalbertodt/reinda/actions/workflows/ci.yml)
[](https://crates.io/crates/reinda)
[](https://docs.rs/reinda)This library helps your web applications manage your assets (external files).
Assets can be compressed and embedded into the binary file to obtain an easy to
deploy standalone executable. In debug mode, assets are loaded dynamically to
avoid having to recompile the backend. A hash can be automatically included in
an asset's filename to enable good caching on the web. In release mode, this
crate prepares everything up-front such that the actually serving the file via
HTTP can be as fast as possible.You might know the crate `rust-embed`: `reinda` does basically the same, but for
the most part has more features and is more flexible (in my opinion).**Tiny example**:
```rust
use reinda::{Assets, Embeds, embed};// Embed some assets
const EMBEDS: Embeds = embed! {
base_path: "../assets",
files: ["index.html", "bundle.*.js"],
};// Configure assets
let mut builder = Assets::build();
builder.add_embedded("index.html", &EMBEDS["index.html"]);
builder.add_embedded("static/", &EMBEDS["bundle.*.js"]);
let assets = builder.build().await?;// Retrieve asset for serving. The `.await?` is only there for the "dev" mode
// when the file is dynamically loaded. In release mode, the final `Bytes`
// are already stored inside `assets`.
let bytes = assets.get("index.html").unwrap().content().await?;
```See [**the documentation**](https://docs.rs/reinda) for more information.
## Status of this project
While this crate is not used by many projects yet, we use it in production for a
couple of years already. If you have any thoughts about this project, please
let me know in [this community feedback issue](https://github.com/LukasKalbertodt/reinda/issues/10)!
---
## License
Licensed under either of Apache License, Version
2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this project by you, as defined in the Apache-2.0 license,
shall be dual licensed as above, without any additional terms or conditions.