diff --git a/Cargo.toml b/Cargo.toml index 56d57b9..a624487 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mince" -version = "0.0.5" +version = "0.0.6" authors = ["Esteban Borai "] edition = "2021" diff --git a/README.md b/README.md index ccfa743..101b228 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # mince Mince comes from "mincing" which means taking something that is roughly chopped and then chopping it finely +> **Warning** This package is under heavy development + ## Development 1. Install `wasm-pack` diff --git a/src/image.rs b/src/image.rs index 60841ff..fbfbacc 100644 --- a/src/image.rs +++ b/src/image.rs @@ -1,4 +1,3 @@ -use std::io::BufWriter; use std::io::Cursor; use image::imageops::FilterType; @@ -131,19 +130,6 @@ impl Mince { Mince::new(dynamic_image, self.meta()) } - fn bytes(&self) -> Vec { - let bytes = Cursor::new(Vec::new()); - let mut buf = BufWriter::new(bytes); - let format: ImageOutputFormat = self.meta.format.into(); - self.inner.write_to(&mut buf, format).unwrap(); - - buf.buffer().to_vec() - } - - fn uint8_array(&self) -> Uint8Array { - Uint8Array::from(self.bytes().as_slice()) - } - pub fn write_blob(&self) -> Blob { let mut options = BlobPropertyBag::new(); options.type_(self.meta.format.mime()); @@ -159,7 +145,7 @@ impl Mince { pub fn write_file(&self) -> File { let sequence = Array::new(); - sequence.set(0, self.uint8_array().into()); + sequence.set(0, self.write_blob().into()); let mut options = FilePropertyBag::new();