#file #desktop #web #async #load-file #serve #request

platter

Load files on web and desktop asynchronously

4 releases

0.1.4 Dec 22, 2019
0.1.3 Dec 22, 2019
0.1.2 Dec 22, 2019
0.1.1 Oct 25, 2019
0.1.0 Oct 17, 2019

#1419 in Filesystem

Download history 89/week @ 2024-07-20 74/week @ 2024-07-27 73/week @ 2024-08-03 120/week @ 2024-08-10 77/week @ 2024-08-17 77/week @ 2024-08-24 89/week @ 2024-08-31 76/week @ 2024-09-07 70/week @ 2024-09-14 99/week @ 2024-09-21 83/week @ 2024-09-28 21/week @ 2024-10-05 52/week @ 2024-10-12 52/week @ 2024-10-19 56/week @ 2024-10-26 82/week @ 2024-11-02

242 downloads per month
Used in 3 crates (2 directly)

MIT OR Apache-2.0 OR Zlib

11KB
172 lines

platter

A simple utility to serve you files on a platter

platter works on both desktop and web, and returns a byte buffer of the file's contents. On desktop, load_file is backed by native file system APIs. On web, it is backed by an HTTP 'GET' request.

let file_contents = load_file("path_to_my_file").await?;

Web Support

To use platter on the web, enable either the web-sys feature (for wasm-pack and wasm-bindgen workflows) or the stdweb feature (for stdweb and cargo-web workflows).


lib.rs:

A simple utility to serve you files on a platter

platter works on both desktop and web, and returns a byte buffer of the file's contents. On desktop, load_file is backed by native file system APIs. On web, it is backed by an HTTP 'GET' request.

To use platter on the web, you'll need to choose either the stdweb or web-sys feature and enable it. This determines which method of binding to browser APIs platter will use.

Dependencies

~0.5–3.5MB
~63K SLoC