diff options
| author | Dieter Eickstaedt <eickstaedt@deicon.de> | 2023-09-23 10:56:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-23 08:56:55 +0000 |
| commit | fbed2862fda127b747718e4ae6f5f36a56f29a51 (patch) | |
| tree | d34481f59f05aa5f9e0131c416373e5c1278dc17 /atuin-client/src/import/mod.rs | |
| parent | Bump debian from bullseye-20230904-slim to bullseye-20230919-slim (#1242) (diff) | |
| download | atuin-fbed2862fda127b747718e4ae6f5f36a56f29a51.zip | |
refactor: Duplications reduced in order to align implementations of reading history files (#1247)
Diffstat (limited to 'atuin-client/src/import/mod.rs')
| -rw-r--r-- | atuin-client/src/import/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/atuin-client/src/import/mod.rs b/atuin-client/src/import/mod.rs index 3d38cd29..0c15c9dd 100644 --- a/atuin-client/src/import/mod.rs +++ b/atuin-client/src/import/mod.rs @@ -1,3 +1,5 @@ +use std::fs::File; +use std::io::Read; use std::path::PathBuf; use async_trait::async_trait; @@ -74,6 +76,12 @@ where } } +fn read_to_end(path: PathBuf) -> Result<Vec<u8>> { + let mut bytes = Vec::new(); + let mut f = File::open(path)?; + f.read_to_end(&mut bytes)?; + Ok(bytes) +} fn is_file(p: PathBuf) -> Result<PathBuf> { if p.is_file() { Ok(p) |
