Write bytes to the store and return their address (blake3 hash)
(bytes: &[u8])
| 84 | |
| 85 | /// Write bytes to the store and return their address (blake3 hash) |
| 86 | pub fn write(bytes: &[u8]) -> StoreResult<Address> { |
| 87 | let addr = Address::hash(bytes); |
| 88 | let path = Self::store_path(&addr)?; |
| 89 | fs::write(path, bytes)?; |
| 90 | Ok(addr) |
| 91 | } |
| 92 | |
| 93 | /// Read bytes from the store given an address |
| 94 | pub fn read(addr: &Address) -> StoreResult<Vec<u8>> { |