fix: chunk size

This commit is contained in:
DecDuck
2025-05-27 10:34:44 +10:00
parent 4ac19b8be0
commit 16b78bca17
4 changed files with 6 additions and 5 deletions

View File

@ -2,7 +2,7 @@ import test from "ava";
import fs from "node:fs";
import path from "path";
import { generateManifest } from "../index.js";
import { generateManifest, listFiles } from "../index.js";
test("numerous small file", async (t) => {
// Setup test dir

View File

@ -1,6 +1,6 @@
{
"name": "@drop-oss/droplet",
"version": "1.1.1",
"version": "1.1.2",
"main": "index.js",
"types": "index.d.ts",
"napi": {

View File

@ -6,6 +6,9 @@ use std::{
path::{Path, PathBuf},
};
const CHUNK_SIZE: usize = 1024 * 1024 * 64;
fn _list_files(vec: &mut Vec<PathBuf>, path: &Path) {
if metadata(path).unwrap().is_dir() {
let paths = fs::read_dir(path).unwrap();
@ -69,7 +72,7 @@ impl VersionBackend for PathVersionBackend {
fn reader(&self, file: &VersionFile) -> BufReader<File> {
let file = File::open(self.base_dir.join(file.relative_filename.clone())).unwrap();
let reader = BufReader::with_capacity(4096, file);
let reader = BufReader::with_capacity(CHUNK_SIZE, file);
return reader;
}
}

View File

@ -18,8 +18,6 @@ use uuid::Uuid;
use crate::file_utils::create_backend_for_path;
const CHUNK_SIZE: usize = 1024 * 1024 * 64;
#[derive(serde::Serialize)]
struct ChunkData {
permissions: u32,