In-Memory Filesystem extension is an in-memory storage extension designed for storing and retrieving data from memory.
Note: This extension is used for development and testing purposes. The use of this extension will result in data loss if it is not pulled from memory.
WARNING: PLEASE BE SURE TO HAVE ENOUGH AVAILABLE MEMORY BEFORE STORING ANY LARGE AMOUNTS OF DATA IN MEMORY, OTHERWISE THERE IS A CHANGE OF SYSTEM INSTABILITY OR THE APPLICATION CRASHES DUE TO AN OUT-OF-MEMORY ERROR
In your cargo project add the following
[dependencies]
warp = { git = "https://github.com/Satellite-im/Warp" }
warp-extensions = { git = "https://github.com/Satellite-im/Warp", features = ["fs_memory"] }
use warp::constellation::Constellation;
use warp_extensions::fs_memory::MemorySystem;
let mut system = MemorySystem::new();
use warp::constellation::Constellation;
use warp_extensions::fs_memory::MemorySystem;
let mut system = MemorySystem::new();
system.put_buffer("new_file", &b"This is content to the file".to_vec()).await.unwrap();
use warp::constellation::Constellation;
use warp_extensions::fs_memory::MemorySystem;
let mut system = MemorySystem::new();
let buffer = system.get_buffer("new_file").await.unwrap();
println!("{}", String::from_utf8_lossy(&buffer));