From 941d2f2a3e73eadde982c44774176a7c56d52e1f Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Mon, 29 Aug 2022 10:31:24 -0300 Subject: [PATCH] Moved packed filesystem section out of the docs (relevant parts into the tutorial) --- docs/README.md | 36 ---- docs/images/packed.svg | 384 ----------------------------------------- 2 files changed, 420 deletions(-) delete mode 100644 docs/images/packed.svg diff --git a/docs/README.md b/docs/README.md index 3b776e25..3a68c9e4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4150,39 +4150,3 @@ Usage example: ```c mg_file_printf(&mg_fs_fat, "/test.txt", "%s\n", "hi"); ``` - -### Packed filesystem - -A packed filesystem allow to "pack" filesystem into a C file which then can -be compiled into the binary, forming a read-only file system. -This makes it possible to serve files on devices with no -filesystem. Even on devices with a filesystem, packing some files like Web UI -can be beneficial to be resilient to filesystem errors. - - -In order to use packed filesystem do the following: - -1. Build **pack** tool from test/pack.c: -```sh -$ cc -o pack pack.c -``` - -2. Convert list of files into single .c: -```sh -$ ./pack index.html style.css > packed_fs.c -``` - -3. Build your app with `packed_fs.c`: -```sh -$ cc mongoose.c app.c packed_fs.c -DMG_ENABLE_PACKED_FS=1 -``` - -packed filesystem - -4. In your application code: -```c -struct mg_http_serve_opts opts = {}; // Initialise empty options -opts.fs = &mg_fs_packed; // Use packed filesystem -opts.root_dir = "/"; // Set root directory -mg_http_serve_dir(c, hm, &opts); // Serve directory -``` diff --git a/docs/images/packed.svg b/docs/images/packed.svg deleted file mode 100644 index 2859ed75..00000000 --- a/docs/images/packed.svg +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - - - packed_fs.c - - - - - - - - - - - - - - - - - - - - - - - - filex.y - - - - - - - - - - - - - - - - - - - - - - main.js - - - - - - - - - - - - - - - - - - - - - - - - - - style.css - - - - - - - - - - - - - - - - - - - - - - index.html - - - - - - - - - - - - packed_fs.c - - - - - - - - mg_unpack() - - - mg_unlist() - - - - - - - - - - - - - - - - - - - - - - - mongoose.c - - - - - - - - - - - - - - - - - - - - - app.c - - - - - - - - - - - - - PACK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - APP.EXE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BUILD - - - - - - - - - - - - - - - BUILD - - - -