rust-fatfs/README.md

61 lines
1.9 KiB
Markdown
Raw Normal View History

Rust FAT FS
===========
2017-09-23 04:36:51 +08:00
[![Travis Build Status](https://travis-ci.org/rafalh/rust-fatfs.svg?branch=master)](https://travis-ci.org/rafalh/rust-fatfs)
2017-10-11 06:57:31 +08:00
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
[![crates.io](http://meritbadge.herokuapp.com/fatfs)](https://crates.io/crates/fatfs)
[![Documentation](https://docs.rs/fatfs/badge.svg)](https://docs.rs/fatfs)
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.24+-yellow.svg)](https://blog.rust-lang.org/2018/02/15/Rust-1.24.html)
2017-09-27 20:21:01 +08:00
2017-10-10 03:14:28 +08:00
FAT filesystem library implemented in Rust.
Features:
2017-11-08 08:35:47 +08:00
* read/write/create/remove file,
* enumerate directory children,
* create/remove directory,
2018-05-10 21:05:44 +08:00
* read/write file timestamps (updated automatically if `chrono` feature is enabled),
* FAT12, FAT16, FAT32 compatibility,
2018-05-10 21:05:44 +08:00
* LFN (Long File Names) extension supported,
* Basic no_std environment support.
Usage
-----
2017-11-08 08:35:47 +08:00
Put this in your `Cargo.toml`:
[dependencies]
2017-11-09 06:02:26 +08:00
fatfs = "0.2"
Put this in your crate root:
extern crate fatfs;
You can start using library now:
let img_file = File::open("fat.img")?;
let mut buf_stream = fatfs::BufStream::new(img_file);
let fs = fatfs::FileSystem::new(&mut buf_stream, fatfs::FsOptions::new())?;
2017-11-08 08:35:47 +08:00
let mut root_dir = fs.root_dir();
let mut file = root_dir.create_file("hello.txt")?;
file.write_all(b"Hello World!")?;
2017-11-08 08:35:47 +08:00
See more examples in `examples` subdirectory.
2017-09-23 04:36:51 +08:00
2018-05-10 07:00:24 +08:00
no_std usage
------------
Put this in your `Cargo.toml`:
[dependencies]
fatfs = { version = "0.2", features = ["core_io"], default-features = false }
2018-05-10 21:14:09 +08:00
Note: LFN support requires `alloc` and `core_io/collections` features and makes use of `alloc` crate.
2018-05-10 21:00:59 +08:00
You may have to provide a memory allocator implementation.
For building in `no_std` mode nightly Rust version compatible with current `core_io` crate is required.
See date string in `core_io` dependency version.
2018-05-10 07:00:24 +08:00
2017-09-23 04:36:51 +08:00
License
-------
The MIT license. See LICENSE.txt.