balena-image-fs 7.4.0-build-get-filesystem-label-66623b9a0b714b989bb19cef1b554c6a7db7a6eb-1 → 7.4.0-build-get-filesystem-label-e43743f757427b7c05603e81c555b66264fa7020-1
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 +1 -1
- package/README.md +0 -22
- package/build/fsLabel.d.ts +28 -0
- package/build/fsLabel.js +106 -0
- package/build/fsLabel.js.map +1 -0
- package/build/index.d.ts +1 -17
- package/build/index.js +4 -75
- package/build/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file
|
|
|
4
4
|
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
|
5
5
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
-
## 7.4.0 - 2025-01-
|
|
7
|
+
## 7.4.0 - 2025-01-17
|
|
8
8
|
|
|
9
9
|
* Add getLabel() to retrieve filesystem label [Ken Bannister]
|
|
10
10
|
|
package/README.md
CHANGED
|
@@ -27,11 +27,6 @@ $ npm install --save balena-image-fs
|
|
|
27
27
|
Documentation
|
|
28
28
|
-------------
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
* [imagefs](#module_imagefs)
|
|
32
|
-
* [~interact()](#module_imagefs..interact)
|
|
33
|
-
* [~getLabel()](#module_imagefs..getLabel)
|
|
34
|
-
|
|
35
30
|
<a name="module_imagefs..interact"></a>
|
|
36
31
|
|
|
37
32
|
### imagefs~interact()
|
|
@@ -44,23 +39,6 @@ const contents = await interact('/foo/bar.img', 5, async (fs) => {
|
|
|
44
39
|
});
|
|
45
40
|
console.log(contents);
|
|
46
41
|
```
|
|
47
|
-
<a name="module_imagefs..getLabel"></a>
|
|
48
|
-
|
|
49
|
-
### imagefs~getLabel()
|
|
50
|
-
**Kind**: inner method of [<code>imagefs</code>](#module_imagefs)
|
|
51
|
-
**Summary**: Return the label encoded in the filesystem for a given partition,
|
|
52
|
-
or an empty string if one can't be found.
|
|
53
|
-
**Example**
|
|
54
|
-
```js
|
|
55
|
-
await filedisk.withOpenFile('/foo/bar.img', 'r', async (handle) => {
|
|
56
|
-
const disk = new filedisk.FileDisk(handle);
|
|
57
|
-
const info = partitioninfo.getPartitions(disk);
|
|
58
|
-
for (const partition of info.partitions) {
|
|
59
|
-
const label = await getLabel(disk, partition);
|
|
60
|
-
console.log(`${partition.index}: ${label}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
42
|
|
|
65
43
|
Support
|
|
66
44
|
-------
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Disk } from 'file-disk';
|
|
2
|
+
import { GPTPartition, MBRPartition } from 'partitioninfo';
|
|
3
|
+
import { TypedError } from 'typed-error';
|
|
4
|
+
/**
|
|
5
|
+
* @summary An error to describe why getLabel() failed to find a filesystem label.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LabelNotFound extends TypedError {
|
|
8
|
+
constructor(partitionIndex: number, description: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @summary Returns the label encoded in the filesystem for a given partition,
|
|
12
|
+
* or throws LabelNotFound if can't determine label location.
|
|
13
|
+
*
|
|
14
|
+
* This function focuses on balenaOS devices and does not attempt to read the
|
|
15
|
+
* many possible filesystem types.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* await filedisk.withOpenFile('/foo/bar.img', 'r', async (handle) => {
|
|
20
|
+
* const disk = new filedisk.FileDisk(handle);
|
|
21
|
+
* const info = partitioninfo.getPartitions(disk);
|
|
22
|
+
* for (const partition of info.partitions) {
|
|
23
|
+
* const label = await getLabel(disk, partition);
|
|
24
|
+
* console.log(`${partition.index}: ${label}`);
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
export declare function getLabel(disk: Disk, partition: GPTPartition | MBRPartition): Promise<string>;
|
package/build/fsLabel.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLabel = exports.LabelNotFound = void 0;
|
|
4
|
+
const typed_error_1 = require("typed-error");
|
|
5
|
+
// GPT partition GUIDs
|
|
6
|
+
// https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
|
|
7
|
+
const GUID_EFI_SYSTEM = 'C12A7328-F81F-11D2-BA4B-00A0C93EC93B';
|
|
8
|
+
const GUID_MS_BASIC_DATA = 'EBD0A0A2-B9E5-4433-87C0-68B6B72699C7';
|
|
9
|
+
const GUID_LINUX_NATIVE = '0FC63DAF-8483-4772-8E79-3D69D8477DE4';
|
|
10
|
+
/**
|
|
11
|
+
* @summary An error to describe why getLabel() failed to find a filesystem label.
|
|
12
|
+
*/
|
|
13
|
+
class LabelNotFound extends typed_error_1.TypedError {
|
|
14
|
+
constructor(partitionIndex, description) {
|
|
15
|
+
super(`Label not found: ${partitionIndex}; ${description}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.LabelNotFound = LabelNotFound;
|
|
19
|
+
/**
|
|
20
|
+
* @summary Returns the label encoded in the filesystem for a given partition,
|
|
21
|
+
* or throws LabelNotFound if can't determine label location.
|
|
22
|
+
*
|
|
23
|
+
* This function focuses on balenaOS devices and does not attempt to read the
|
|
24
|
+
* many possible filesystem types.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
*
|
|
28
|
+
* await filedisk.withOpenFile('/foo/bar.img', 'r', async (handle) => {
|
|
29
|
+
* const disk = new filedisk.FileDisk(handle);
|
|
30
|
+
* const info = partitioninfo.getPartitions(disk);
|
|
31
|
+
* for (const partition of info.partitions) {
|
|
32
|
+
* const label = await getLabel(disk, partition);
|
|
33
|
+
* console.log(`${partition.index}: ${label}`);
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
*/
|
|
37
|
+
async function getLabel(disk, partition) {
|
|
38
|
+
const isGpt = 'guid' in partition;
|
|
39
|
+
const isMbr = !isGpt;
|
|
40
|
+
// Read filesystem metadata. May need further reads depending on filesystem.
|
|
41
|
+
let buf = Buffer.alloc(0x100);
|
|
42
|
+
await disk.read(buf, 0, buf.length, partition.offset);
|
|
43
|
+
let labelOffset = 0;
|
|
44
|
+
let maxLength = 0;
|
|
45
|
+
// A filesystem places the label in a certain position in its metadata. So
|
|
46
|
+
// we must determine the type of filesystem. We first narrow the possibilities
|
|
47
|
+
// by checking the partition type (MBR) or GUID (GPT) for the containing partition.
|
|
48
|
+
// There are two broad categories -- FAT types and Linux native types. Finally
|
|
49
|
+
// we confirm the presence of signature bytes within the filesystem metadata.
|
|
50
|
+
// https://en.wikipedia.org/wiki/Partition_type
|
|
51
|
+
const mbrFatTypes = [0xB, 0xC, 0xE];
|
|
52
|
+
const gptFatTypes = [GUID_EFI_SYSTEM, GUID_MS_BASIC_DATA];
|
|
53
|
+
let foundPartType = false;
|
|
54
|
+
let foundLabel = false;
|
|
55
|
+
if (isMbr && mbrFatTypes.some(ptype => partition.type === ptype)
|
|
56
|
+
|| isGpt && gptFatTypes.some(ptype => partition.type === ptype)) {
|
|
57
|
+
foundPartType = true;
|
|
58
|
+
maxLength = 11;
|
|
59
|
+
// FAT16
|
|
60
|
+
if (buf.readUInt8(0x26) === 0x29) {
|
|
61
|
+
labelOffset = 0x2B;
|
|
62
|
+
foundLabel = true;
|
|
63
|
+
// FAT32
|
|
64
|
+
}
|
|
65
|
+
else if (buf.readUInt8(0x42) === 0x29) {
|
|
66
|
+
labelOffset = 0x47;
|
|
67
|
+
foundLabel = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Linux filesytem of some kind
|
|
71
|
+
const gptLinuxTypes = [GUID_LINUX_NATIVE, GUID_MS_BASIC_DATA];
|
|
72
|
+
if (!foundLabel
|
|
73
|
+
&& ((isMbr && partition.type === 0x83)
|
|
74
|
+
|| (isGpt && gptLinuxTypes.some(ptype => partition.type === ptype)))) {
|
|
75
|
+
foundPartType = true;
|
|
76
|
+
maxLength = 16;
|
|
77
|
+
// ext2+; reload buffer within superblock
|
|
78
|
+
await disk.read(buf, 0, buf.length, partition.offset + 0x400);
|
|
79
|
+
if (buf.readUInt16LE(0x38) === 0xEF53) {
|
|
80
|
+
labelOffset = 0x78;
|
|
81
|
+
foundLabel = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Fail on unexpected partition/filesystem
|
|
85
|
+
if (!foundPartType) {
|
|
86
|
+
throw new LabelNotFound(partition.index, 'unexpected partition type');
|
|
87
|
+
}
|
|
88
|
+
else if (!foundLabel) {
|
|
89
|
+
throw new LabelNotFound(partition.index, 'can\'t read filesystem');
|
|
90
|
+
}
|
|
91
|
+
// Exclude trailing /0 bytes to stringify.
|
|
92
|
+
let i = 0;
|
|
93
|
+
for (; i <= maxLength; i++) {
|
|
94
|
+
// If label fills available space, no need to test. We just need i
|
|
95
|
+
// to have the expected value for Buffer.toString() call below.
|
|
96
|
+
if (i == maxLength) {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (buf.readUInt8(labelOffset + i) == 0) {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return buf.toString('utf8', labelOffset, labelOffset + i).trim();
|
|
104
|
+
}
|
|
105
|
+
exports.getLabel = getLabel;
|
|
106
|
+
//# sourceMappingURL=fsLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fsLabel.js","sourceRoot":"","sources":["../lib/fsLabel.ts"],"names":[],"mappings":";;;AAEA,6CAAyC;AAEzC,sBAAsB;AACtB,0EAA0E;AAC1E,MAAM,eAAe,GAAG,sCAAsC,CAAC;AAC/D,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AAClE,MAAM,iBAAiB,GAAG,sCAAsC,CAAC;AAEjE;;GAEG;AACH,MAA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AA+D;QAC/D,IAAI,CAAC,IAAI,SAAS,EAAE;YACnB,MAAM;SACN;QACD,IAAI,GAAG,CAAC,SAAS,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE;YACxC,MAAM;SACN;KACD;IAED,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC;AA1ED,4BA0EC"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as Fs from 'fs';
|
|
3
3
|
import { Disk } from 'file-disk';
|
|
4
|
-
|
|
4
|
+
export { getLabel, LabelNotFound } from './fsLabel';
|
|
5
5
|
/**
|
|
6
6
|
* @summary Run a function with a node fs like interface for a partition
|
|
7
7
|
*
|
|
@@ -14,19 +14,3 @@ import * as partitioninfo from 'partitioninfo';
|
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
export declare function interact<T>(disk: Disk | string, partition: number | undefined, fn: (fs: typeof Fs) => Promise<T>): Promise<T>;
|
|
17
|
-
/**
|
|
18
|
-
* @summary Return the label encoded in the filesystem for a given partition,
|
|
19
|
-
* or an empty string if one can't be found.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* await filedisk.withOpenFile('/foo/bar.img', 'r', async (handle) => {
|
|
24
|
-
* const disk = new filedisk.FileDisk(handle);
|
|
25
|
-
* const info = partitioninfo.getPartitions(disk);
|
|
26
|
-
* for (const partition of info.partitions) {
|
|
27
|
-
* const label = await getLabel(disk, partition);
|
|
28
|
-
* console.log(`${partition.index}: ${label}`);
|
|
29
|
-
* }
|
|
30
|
-
* }
|
|
31
|
-
*/
|
|
32
|
-
export declare function getLabel(disk: Disk, partition: partitioninfo.GPTPartition | partitioninfo.MBRPartition): Promise<string>;
|
package/build/index.js
CHANGED
|
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.interact = exports.LabelNotFound = exports.getLabel = void 0;
|
|
19
19
|
/**
|
|
20
20
|
* @module imagefs
|
|
21
21
|
*/
|
|
@@ -26,6 +26,9 @@ const util_1 = require("util");
|
|
|
26
26
|
const file_disk_1 = require("file-disk");
|
|
27
27
|
const partitioninfo = require("partitioninfo");
|
|
28
28
|
const typed_error_1 = require("typed-error");
|
|
29
|
+
var fsLabel_1 = require("./fsLabel");
|
|
30
|
+
Object.defineProperty(exports, "getLabel", { enumerable: true, get: function () { return fsLabel_1.getLabel; } });
|
|
31
|
+
Object.defineProperty(exports, "LabelNotFound", { enumerable: true, get: function () { return fsLabel_1.LabelNotFound; } });
|
|
29
32
|
class MountError extends typed_error_1.TypedError {
|
|
30
33
|
}
|
|
31
34
|
const SECTOR_SIZE = 512;
|
|
@@ -159,78 +162,4 @@ async function interact(disk, partition, fn) {
|
|
|
159
162
|
}
|
|
160
163
|
}
|
|
161
164
|
exports.interact = interact;
|
|
162
|
-
/**
|
|
163
|
-
* @summary Return the label encoded in the filesystem for a given partition,
|
|
164
|
-
* or an empty string if one can't be found.
|
|
165
|
-
*
|
|
166
|
-
* @example
|
|
167
|
-
*
|
|
168
|
-
* await filedisk.withOpenFile('/foo/bar.img', 'r', async (handle) => {
|
|
169
|
-
* const disk = new filedisk.FileDisk(handle);
|
|
170
|
-
* const info = partitioninfo.getPartitions(disk);
|
|
171
|
-
* for (const partition of info.partitions) {
|
|
172
|
-
* const label = await getLabel(disk, partition);
|
|
173
|
-
* console.log(`${partition.index}: ${label}`);
|
|
174
|
-
* }
|
|
175
|
-
* }
|
|
176
|
-
*/
|
|
177
|
-
async function getLabel(disk, partition) {
|
|
178
|
-
// If GPT, can we just read the protective MBR?
|
|
179
|
-
// Is there a more Typescript native way to determine partition table type?
|
|
180
|
-
// const isGpt = 'guid' in partition;
|
|
181
|
-
// Linux native FS, expecting ext2+, so skip to superblock for metadata.
|
|
182
|
-
let metadataOffset = 0;
|
|
183
|
-
if (partition.type === 0x83) {
|
|
184
|
-
metadataOffset += 0x400;
|
|
185
|
-
}
|
|
186
|
-
// Read filesystem metadata
|
|
187
|
-
let buf = Buffer.alloc(0x100);
|
|
188
|
-
await disk.read(buf, 0, buf.length, partition.offset + metadataOffset);
|
|
189
|
-
let labelOffset = 0;
|
|
190
|
-
let maxLength = 0;
|
|
191
|
-
// First verify magic signature to determine metadata layout for label offset.
|
|
192
|
-
const fatTypes = [0xB, 0xC, 0xE];
|
|
193
|
-
if (fatTypes.some(ptype => partition.type === ptype)) {
|
|
194
|
-
maxLength = 11;
|
|
195
|
-
// FAT16
|
|
196
|
-
if (buf.readUInt8(0x26) === 0x29) {
|
|
197
|
-
labelOffset = 0x2B;
|
|
198
|
-
// FAT32
|
|
199
|
-
}
|
|
200
|
-
else if (buf.readUInt8(0x42) === 0x29) {
|
|
201
|
-
labelOffset = 0x47;
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
return '';
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
else if (partition.type === 0x83) {
|
|
208
|
-
maxLength = 16;
|
|
209
|
-
if (buf.readUInt16LE(0x38) === 0xEF53) {
|
|
210
|
-
labelOffset = 0x78;
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
return '';
|
|
214
|
-
}
|
|
215
|
-
// Unexpected partition type
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
return '';
|
|
219
|
-
}
|
|
220
|
-
// Identify and exclude trailing /0 bytes to stringify.
|
|
221
|
-
let i = 0;
|
|
222
|
-
for (; i <= maxLength; i++) {
|
|
223
|
-
// If label fills available space, no need to test. We just need i
|
|
224
|
-
// to have the expected value for Buffer.toString() call below.
|
|
225
|
-
if (i == maxLength) {
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
if (buf.readUInt8(labelOffset + i) == 0) {
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
const label = buf.toString('utf8', labelOffset, labelOffset + i).trim();
|
|
233
|
-
return label;
|
|
234
|
-
}
|
|
235
|
-
exports.getLabel = getLabel;
|
|
236
165
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF;;GAEG;AAEH,iCAAiC;AACjC,+BAA+B;AAC/B,yBAAyB;AACzB,+BAAiC;AACjC,yCAAyD;AACzD,+CAA+C;AAC/C,6CAAyC;AAEzC,MAAM,UAAW,SAAQ,wBAAU;CAAG;AAEtC,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,KAAK,UAAU,QAAQ,CACtB,IAAU,EACV,MAAc,EACd,IAAY,EACZ,EAAiC;IAEjC,SAAS,cAAc,CAAC,MAAc;QACrC,OAAO,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,CAAC;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,gBAAgB,CAAC;QAClC,UAAU,EAAE,WAAW;QACvB,UAAU,EAAE,IAAI,GAAG,WAAW;QAC9B,WAAW,EAAE,KAAK,EACjB,MAAc,EACd,IAAY,EACZ,QAIS,EACO,EAAE;YAClB,IAAI;gBACH,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAC5C,IAAI,EACJ,CAAC,EACD,IAAI,CAAC,MAAM,EACX,cAAc,CAAC,MAAM,CAAC,CACtB,CAAC;gBACF,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;aAClC;YAAC,OAAO,CAAM,EAAE;gBAChB,QAAQ,CAAC,CAAC,CAAC,CAAC;aACZ;QACF,CAAC;QACD,YAAY,EA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,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;KAChD;AACF,CAAC;AAED,KAAK,UAAU,YAAY,CAC1B,IAAU,EACV,SAA6B,EAC7B,EAAiC;IAEjC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACnE,OAAO,MAAM,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;;;;GAUG;AACI,KAAK,UAAU,QAAQ,CAC7B,IAAmB,EACnB,SAA6B,EAC7B,EAAiC;IAEjC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC7B,OAAO,MAAM,IAAA,wBAAY,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACtD,IAAI,GAAG,IAAI,oBAAQ,CAAC,MAAM,CAAC,CAAC;YAC5B,OAAO,MAAM,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;KACH;SAAM,IAAI,IAAI,YAAY,gBAAI,EAAE;QAChC,OAAO,MAAM,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;KAC/C;SAAM;QACN,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KACzE;AACF,CAAC;AAfD,4BAeC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "balena-image-fs",
|
|
3
|
-
"version": "7.4.0-build-get-filesystem-label-
|
|
3
|
+
"version": "7.4.0-build-get-filesystem-label-e43743f757427b7c05603e81c555b66264fa7020-1",
|
|
4
4
|
"description": "Image filesystem manipulation utilities",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"homepage": "https://github.com/balena-io-modules/balena-image-fs",
|
|
@@ -59,6 +59,6 @@
|
|
|
59
59
|
"node": ">=16"
|
|
60
60
|
},
|
|
61
61
|
"versionist": {
|
|
62
|
-
"publishedAt": "2025-01-
|
|
62
|
+
"publishedAt": "2025-01-17T04:02:02.599Z"
|
|
63
63
|
}
|
|
64
64
|
}
|