mharj-diskinfo 0.2.1 → 0.2.2
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/README.md +6 -0
- package/dist/index.cjs +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# diskinfo
|
|
2
2
|
|
|
3
|
+
[](https://github.com/ellerbrock/typescript-badges/)
|
|
4
|
+
[](https://badge.fury.io/js/mharj-diskinfo)
|
|
5
|
+
[](https://qlty.sh/gh/mharj/projects/diskinfo)
|
|
6
|
+
[](https://qlty.sh/gh/mharj/projects/diskinfo)
|
|
7
|
+
[](https://github.com/mharj/diskinfo/actions/workflows/main.yml)
|
|
8
|
+
|
|
3
9
|
read disk partition and filesystem information with NodeJS
|
|
4
10
|
Requires: NodeJS 10.4 as using Bigint
|
|
5
11
|
|
package/dist/index.cjs
CHANGED
|
@@ -220,7 +220,7 @@ function isMbrPartition(part) {
|
|
|
220
220
|
//#region src/scan.ts
|
|
221
221
|
async function getMbrPartitions(handle, startLBA) {
|
|
222
222
|
const buffer = Buffer.allocUnsafe(512);
|
|
223
|
-
await handle.read(buffer, 0, 512, 512);
|
|
223
|
+
await handle.read(buffer, 0, 512, startLBA * 512);
|
|
224
224
|
const output = [];
|
|
225
225
|
const extparts = parseMBR(buffer);
|
|
226
226
|
for (const extpart of extparts.partitions) {
|
|
@@ -258,7 +258,10 @@ async function scan(handle) {
|
|
|
258
258
|
await handle.read(buffer, 0, 512, 0);
|
|
259
259
|
const rootMbr = parseMBR(buffer);
|
|
260
260
|
for (const p of rootMbr.partitions) {
|
|
261
|
-
if (isExtendedPartition(p))
|
|
261
|
+
if (isExtendedPartition(p)) {
|
|
262
|
+
const partitions = await getMbrPartitions(handle, p.startLBA);
|
|
263
|
+
rootMbr.partitions.push(...partitions);
|
|
264
|
+
}
|
|
262
265
|
if (isGptPartition(rootMbr, p)) {
|
|
263
266
|
const { partitions, uuid } = await getGptPartitions(handle);
|
|
264
267
|
rootMbr.type = "GPT";
|
package/dist/index.mjs
CHANGED
|
@@ -196,7 +196,7 @@ function isMbrPartition(part) {
|
|
|
196
196
|
//#region src/scan.ts
|
|
197
197
|
async function getMbrPartitions(handle, startLBA) {
|
|
198
198
|
const buffer = Buffer.allocUnsafe(512);
|
|
199
|
-
await handle.read(buffer, 0, 512, 512);
|
|
199
|
+
await handle.read(buffer, 0, 512, startLBA * 512);
|
|
200
200
|
const output = [];
|
|
201
201
|
const extparts = parseMBR(buffer);
|
|
202
202
|
for (const extpart of extparts.partitions) {
|
|
@@ -234,7 +234,10 @@ async function scan(handle) {
|
|
|
234
234
|
await handle.read(buffer, 0, 512, 0);
|
|
235
235
|
const rootMbr = parseMBR(buffer);
|
|
236
236
|
for (const p of rootMbr.partitions) {
|
|
237
|
-
if (isExtendedPartition(p))
|
|
237
|
+
if (isExtendedPartition(p)) {
|
|
238
|
+
const partitions = await getMbrPartitions(handle, p.startLBA);
|
|
239
|
+
rootMbr.partitions.push(...partitions);
|
|
240
|
+
}
|
|
238
241
|
if (isGptPartition(rootMbr, p)) {
|
|
239
242
|
const { partitions, uuid } = await getGptPartitions(handle);
|
|
240
243
|
rootMbr.type = "GPT";
|
package/package.json
CHANGED