-
-
Save Sorseg/2d440274aca50487db21b8cec1a89dc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "playground" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
ruzstd = {git="https://github.com/KillingSpark/zstd-rs", rev="b64ad31dc46633135feb3e25b7f07822aa4aca69"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{ | |
fs::File, | |
io::{BufReader, Read, Seek, Write}, | |
}; | |
fn main() { | |
let reader = | |
File::open("l0.blend").unwrap(); | |
let mut buffered = BufReader::new(reader); | |
let mut result = vec![]; | |
let save_result = |b| { | |
let mut f = File::create("partial.blend").unwrap(); | |
f.write_all(b).unwrap(); | |
}; | |
let mut tries = 0; | |
loop { | |
// check if more bytes to read | |
if buffered.read_exact(&mut vec![0]).is_err() { | |
break; | |
} | |
// rewind one byte back if more to read | |
buffered.seek_relative(-1).unwrap(); | |
println!("More to read at {} / 129452", buffered.stream_position().unwrap()); | |
// try to decode the rest | |
match ruzstd::StreamingDecoder::new(&mut buffered) { | |
Err(e) => { | |
save_result(&result); | |
panic!("{e} at try {tries}"); | |
} | |
Ok(mut sd) => { | |
if let Err(e) = sd.read_to_end(&mut result) { | |
save_result(&result); | |
panic!("{e} at try {tries}"); | |
} | |
} | |
} | |
tries += 1; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
More to read at 0 / 129452 | |
More to read at 5617 / 129452 | |
More to read at 6712 / 129452 | |
More to read at 7582 / 129452 | |
More to read at 29577 / 129452 | |
More to read at 33365 / 129452 | |
More to read at 43495 / 129452 | |
More to read at 45308 / 129452 | |
More to read at 45483 / 129452 | |
More to read at 46452 / 129452 | |
More to read at 46971 / 129452 | |
More to read at 47146 / 129452 | |
More to read at 67703 / 129452 | |
More to read at 68378 / 129452 | |
More to read at 68527 / 129452 | |
More to read at 68668 / 129452 | |
More to read at 68979 / 129452 | |
More to read at 70585 / 129452 | |
More to read at 129291 / 129452 | |
thread 'main' panicked at src/main.rs:34:17: | |
SkipFrame(407710302, 153) at try 18 | |
stack backtrace: | |
0: rust_begin_unwind | |
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5 | |
1: core::panicking::panic_fmt | |
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14 | |
2: playground::main | |
at ./src/main.rs:34:17 | |
3: core::ops::function::FnOnce::call_once | |
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5 | |
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a35835626fdac39fbb55f5a57e11c2ffefde0b4afbd6305f03076f8f34b7bf9bfec381befddf86cb9b07e8e60d5f1769de67968f1ac871253afeb1a6503f479c good.blend | |
28262a04c2b465b2e282adf2809e0663898061115e694116c3a165e488deb2d6afb5a2441f9252d43e82a9f9fa9c5461d9482093a0c68e0304ced4360bb3f035 l0.blend | |
a35835626fdac39fbb55f5a57e11c2ffefde0b4afbd6305f03076f8f34b7bf9bfec381befddf86cb9b07e8e60d5f1769de67968f1ac871253afeb1a6503f479c partial.blend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment