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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # diskinfo
2
2
 
3
+ [![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://github.com/ellerbrock/typescript-badges/)
4
+ [![npm version](https://badge.fury.io/js/mharj-diskinfo.svg)](https://badge.fury.io/js/mharj-diskinfo)
5
+ [![Maintainability](https://qlty.sh/gh/mharj/projects/diskinfo/maintainability.svg)](https://qlty.sh/gh/mharj/projects/diskinfo)
6
+ [![Code Coverage](https://qlty.sh/gh/mharj/projects/diskinfo/coverage.svg)](https://qlty.sh/gh/mharj/projects/diskinfo)
7
+ [![CI/CD](https://github.com/mharj/diskinfo/actions/workflows/main.yml/badge.svg)](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)) rootMbr.partitions.push(...await getMbrPartitions(handle, p.startLBA));
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)) rootMbr.partitions.push(...await getMbrPartitions(handle, p.startLBA));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mharj-diskinfo",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Node.js library to parse MBR and GPT partition information from disk images or devices.",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",