mirror of
https://github.com/Drop-OSS/droplet.git
synced 2025-11-24 05:31:48 +10:00
patch issue
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@drop/droplet",
|
"name": "@drop/droplet",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
"napi": {
|
"napi": {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ use napi::Error;
|
|||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
fs::File,
|
fs::File,
|
||||||
io::{self, BufRead, BufReader},
|
io::{self, BufRead, BufReader, Write},
|
||||||
path::Path,
|
path::Path,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
};
|
};
|
||||||
@ -23,12 +23,11 @@ pub mod manifest;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate napi_derive;
|
extern crate napi_derive;
|
||||||
|
|
||||||
fn compress(mut buffer: &[u8], output_path: &Path, chunk_id: Uuid) {
|
fn compress(buffer: &[u8], output_path: &Path, chunk_id: Uuid) {
|
||||||
let chunk_path = output_path.join(chunk_id.to_string() + ".bin");
|
let chunk_path = output_path.join(chunk_id.to_string() + ".bin");
|
||||||
let chunk_file = File::create_new(chunk_path).unwrap();
|
let chunk_file = File::create_new(chunk_path).unwrap();
|
||||||
let mut compressor = zstd::Encoder::new(chunk_file, 5).unwrap();
|
|
||||||
|
|
||||||
io::copy(&mut buffer, &mut compressor).unwrap();
|
zstd::stream::copy_encode(buffer, chunk_file, 7).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
@ -113,7 +112,7 @@ pub async fn repack(source: String, output: String) -> Result<(), Error> {
|
|||||||
|
|
||||||
println!("Queued {}", file_path.to_str().unwrap());
|
println!("Queued {}", file_path.to_str().unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
let manifest_path = output_path.join("manifest.drop");
|
let manifest_path = output_path.join("manifest.drop");
|
||||||
generate_manifest(manifest, &manifest_path);
|
generate_manifest(manifest, &manifest_path);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user