fix(indexer): create blocks_chunks folder if is not exist
This commit is contained in:
parent
caf7b4c673
commit
5ae008dc02
1 changed files with 3 additions and 0 deletions
|
@ -83,6 +83,9 @@ fn write_and_compress_chunk_in_file(
|
||||||
chunks_folder_path: &Path,
|
chunks_folder_path: &Path,
|
||||||
) -> Result<(), std::io::Error> {
|
) -> Result<(), std::io::Error> {
|
||||||
log::info!("blocks_chunk_{}: {} bytes", chunk_index, chunk.len());
|
log::info!("blocks_chunk_{}: {} bytes", chunk_index, chunk.len());
|
||||||
|
if !chunks_folder_path.exists() {
|
||||||
|
std::fs::create_dir(chunks_folder_path)?;
|
||||||
|
}
|
||||||
let file = std::fs::File::create(chunks_folder_path.join(format!("_{}", chunk_index)))?;
|
let file = std::fs::File::create(chunks_folder_path.join(format!("_{}", chunk_index)))?;
|
||||||
let mut e = ZlibEncoder::new(file, Compression::new(3));
|
let mut e = ZlibEncoder::new(file, Compression::new(3));
|
||||||
e.write_all(chunk)?;
|
e.write_all(chunk)?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue