@thi.ng/block-fs 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/cli/convert.js +5 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2025-07-
|
|
3
|
+
- **Last updated**: 2025-07-12T23:11:04Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -11,6 +11,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
11
11
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
12
12
|
and/or version bumps of transitive dependencies.
|
|
13
13
|
|
|
14
|
+
### [0.6.3](https://github.com/thi-ng/umbrella/tree/@thi.ng/block-fs@0.6.3) (2025-07-12)
|
|
15
|
+
|
|
16
|
+
#### 🩹 Bug fixes
|
|
17
|
+
|
|
18
|
+
- update block count calculation (CLI convert cmd) ([95cee85](https://github.com/thi-ng/umbrella/commit/95cee85))
|
|
19
|
+
|
|
14
20
|
### [0.6.2](https://github.com/thi-ng/umbrella/tree/@thi.ng/block-fs@0.6.2) (2025-07-12)
|
|
15
21
|
|
|
16
22
|
#### ♻️ Refactoring
|
package/cli/convert.js
CHANGED
|
@@ -7,6 +7,7 @@ import { Entry } from "../entry.js";
|
|
|
7
7
|
import { BlockFS } from "../fs.js";
|
|
8
8
|
import { MemoryBlockStorage } from "../storage/memory.js";
|
|
9
9
|
import { ARG_BLOCKSIZE } from "./api.js";
|
|
10
|
+
const { ceil, log2 } = Math;
|
|
10
11
|
const CONVERT = {
|
|
11
12
|
opts: {
|
|
12
13
|
...ARG_BLOCKSIZE,
|
|
@@ -108,19 +109,20 @@ const computeBlockCount = (collected, blockSize, logger, numBlocks) => {
|
|
|
108
109
|
const blockDataSizeBytes = requiredBytes(blockSize);
|
|
109
110
|
const blockDataSize = blockSize - blockIDBytes - blockDataSizeBytes;
|
|
110
111
|
const numEntries = collected.files.length + collected.dirs.length;
|
|
111
|
-
const
|
|
112
|
+
const maxEntriesPerBlock = ~~(blockDataSize / Entry.SIZE);
|
|
113
|
+
const numEntryBlocks = ceil(numEntries / maxEntriesPerBlock);
|
|
112
114
|
logger.info("num entries:", numEntries);
|
|
113
115
|
logger.info("num entry blocks:", numEntryBlocks);
|
|
114
116
|
blocks += numEntryBlocks;
|
|
115
117
|
for (let f of collected.files) {
|
|
116
|
-
const size =
|
|
118
|
+
const size = ceil(f.size / blockDataSize);
|
|
117
119
|
logger.debug("file:", f.src, "blocks:", size);
|
|
118
120
|
blocks += size;
|
|
119
121
|
}
|
|
120
122
|
const blockIDBytes2 = requiredBytes(blocks);
|
|
121
123
|
return blockIDBytes2 > blockIDBytes ? computeBlockCount(collected, blockSize, logger, blocks) : blocks;
|
|
122
124
|
};
|
|
123
|
-
const requiredBytes = (x) => align(
|
|
125
|
+
const requiredBytes = (x) => align(ceil(log2(x)), 8) >> 3;
|
|
124
126
|
export {
|
|
125
127
|
CONVERT
|
|
126
128
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/block-fs",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "Customizable block-based storage, adapters & file system layer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -143,5 +143,5 @@
|
|
|
143
143
|
"status": "alpha",
|
|
144
144
|
"year": 2024
|
|
145
145
|
},
|
|
146
|
-
"gitHead": "
|
|
146
|
+
"gitHead": "76111155b9b3b21bc59aa347fc1e7d36c0b0701e\n"
|
|
147
147
|
}
|