Skip to content

Commit e14292a

Browse files
committed
Add a Readme
1 parent 86b1e73 commit e14292a

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Static FileZ
2+
3+
> **Build compressed archives for static files and serve them over HTTP**
4+
5+
[![Build Status](https://travis-ci.com/killercup/static-filez.svg?branch=master)](https://travis-ci.com/killercup/static-filez)
6+
7+
## What and Why
8+
9+
Say you want to store a huge number of very small files
10+
that you are only viewing in a browser.
11+
For example: You are using `rustdoc` to render the documentation of a library.
12+
Without much work you'll end up with about 100k files that are about 10kB each.
13+
As it turns out, this number of small files is very annoying for any kind of file system performance:
14+
Best case: making copies/backups is slow.
15+
Worst case: You're using an anti virus software and it takes ages.
16+
17+
Except for convenience when implementing software,
18+
and people being used to having folders of files they can look into,
19+
there is little reason to store these files individually.
20+
Indeed, it will save much space and time to store files like these in compressed form in one continuous archive.
21+
All that is needed to make this work is
22+
some well-designed and discoverable software.
23+
24+
_static-filez_ is a prototype for that piece of software.
25+
26+
## Installation
27+
28+
For now, `cargo install --git https://github.com/killercup/static-filez`.
29+
30+
## Usage
31+
32+
1. Build an archive (and index) from a directory: `static-filez build target/doc/ ./docs.archive`
33+
2. Start a HTTP server that serves the files in the archive: `static-filez serve -p 3000 docs.archive`
34+
3. Open a browser and see your files: `http://127.0.0.1:3000/regex/`
35+
(`regex` is an example for a great documentation page you should read)
36+
37+
## Architecture
38+
39+
Currently, _static-filez_ will generate two files:
40+
An `.index` file, and an `.archive` file.
41+
42+
The index is a specialized data structure
43+
that maps paths to their content in the archive.
44+
45+
The archive file contains the (compressed) content of your files.
46+
The server is implemented in a way that it can serve the compressed content directly,
47+
with no need to ever look at the (potentially much larger) original decompressed data.
48+
(This works by using the HTTP Content-Encoding header, if you are curios.)
49+
50+
You can read more about the structure of the files in
51+
[this issue](https://github.com/killercup/static-filez/issues/1),
52+
or, of course, the source.
53+
54+
## License
55+
56+
Licensed under either of
57+
58+
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
59+
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
60+
61+
at your option.
62+
63+
### Contribution
64+
65+
Unless you explicitly state otherwise, any contribution intentionally
66+
submitted for inclusion in the work by you, as defined in the Apache-2.0
67+
license, shall be dual licensed as above, without any additional terms or
68+
conditions.

0 commit comments

Comments
 (0)