@photostructure/fs-metadata 1.3.0 → 1.4.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/AGENTS.md +213 -0
- package/CHANGELOG.md +54 -0
- package/CONTRIBUTING.md +3 -3
- package/binding.gyp +0 -22
- package/dist/index.cjs +10 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +10 -39
- package/dist/index.mjs.map +1 -1
- package/doc/C++_REVIEW_TODO.md +3 -36
- package/doc/LINUX_API_REFERENCE.md +4 -147
- package/doc/SECURITY_AUDIT_2026.md +4 -0
- package/doc/gotchas.md +27 -0
- package/package.json +11 -12
- package/prebuilds/darwin-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/darwin-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/linux-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/linux-arm64/@photostructure+fs-metadata.musl.node +0 -0
- package/prebuilds/linux-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/linux-x64/@photostructure+fs-metadata.musl.node +0 -0
- package/prebuilds/win32-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/win32-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/scripts/clang-tidy.ts +1 -3
- package/scripts/prebuild-linux-glibc.sh +1 -5
- package/scripts/sanitizers-test.sh +0 -1
- package/src/binding.cpp +5 -15
- package/src/common/metadata_worker.h +7 -6
- package/src/common/shutdown.h +162 -0
- package/src/darwin/get_mount_point.cpp +6 -4
- package/src/darwin/hidden.cpp +9 -8
- package/src/darwin/hidden.h +4 -3
- package/src/darwin/volume_metadata.cpp +15 -1
- package/src/darwin/volume_mount_points.cpp +26 -4
- package/src/linux/mount_points.ts +8 -42
- package/src/linux/volume_metadata.cpp +5 -17
- package/src/mount_point_for_path.ts +1 -1
- package/src/types/mount_point.ts +1 -1
- package/src/types/native_bindings.ts +0 -5
- package/src/volume_metadata.ts +16 -7
- package/src/volume_mount_points.ts +1 -1
- package/src/windows/hidden.cpp +10 -9
- package/src/windows/volume_metadata.cpp +5 -1
- package/src/windows/volume_mount_points.cpp +22 -4
- package/scripts/setup-native.mjs +0 -39
- package/src/linux/gio_mount_points.cpp +0 -80
- package/src/linux/gio_mount_points.h +0 -37
- package/src/linux/gio_utils.cpp +0 -115
- package/src/linux/gio_utils.h +0 -69
- package/src/linux/gio_volume_metadata.cpp +0 -81
- package/src/linux/gio_volume_metadata.h +0 -20
package/dist/index.d.cts
CHANGED
|
@@ -79,7 +79,7 @@ interface MountPoint {
|
|
|
79
79
|
* verifyVolume`.
|
|
80
80
|
*
|
|
81
81
|
* If there are non-critical errors while extracting metadata, those error
|
|
82
|
-
* messages may be added to this field (say, from blkid
|
|
82
|
+
* messages may be added to this field (say, from blkid).
|
|
83
83
|
*
|
|
84
84
|
* @see {@link VolumeHealthStatuses} for values returned by Windows.
|
|
85
85
|
*/
|
package/dist/index.d.mts
CHANGED
|
@@ -79,7 +79,7 @@ interface MountPoint {
|
|
|
79
79
|
* verifyVolume`.
|
|
80
80
|
*
|
|
81
81
|
* If there are non-critical errors while extracting metadata, those error
|
|
82
|
-
* messages may be added to this field (say, from blkid
|
|
82
|
+
* messages may be added to this field (say, from blkid).
|
|
83
83
|
*
|
|
84
84
|
* @see {@link VolumeHealthStatuses} for values returned by Windows.
|
|
85
85
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ interface MountPoint {
|
|
|
79
79
|
* verifyVolume`.
|
|
80
80
|
*
|
|
81
81
|
* If there are non-critical errors while extracting metadata, those error
|
|
82
|
-
* messages may be added to this field (say, from blkid
|
|
82
|
+
* messages may be added to this field (say, from blkid).
|
|
83
83
|
*
|
|
84
84
|
* @see {@link VolumeHealthStatuses} for values returned by Windows.
|
|
85
85
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -649,11 +649,6 @@ async function* readLinks(directory) {
|
|
|
649
649
|
// src/linux/mount_points.ts
|
|
650
650
|
import { readFile } from "fs/promises";
|
|
651
651
|
|
|
652
|
-
// src/mount_point.ts
|
|
653
|
-
function isMountPoint(obj) {
|
|
654
|
-
return isObject(obj) && "mountPoint" in obj && isNotBlank(obj.mountPoint);
|
|
655
|
-
}
|
|
656
|
-
|
|
657
652
|
// src/options.ts
|
|
658
653
|
import { availableParallelism as availableParallelism2 } from "os";
|
|
659
654
|
import { env as env2 } from "process";
|
|
@@ -1135,49 +1130,25 @@ function parseMtab(content) {
|
|
|
1135
1130
|
}
|
|
1136
1131
|
|
|
1137
1132
|
// src/linux/mount_points.ts
|
|
1138
|
-
async function getLinuxMountPoints(
|
|
1133
|
+
async function getLinuxMountPoints(opts) {
|
|
1139
1134
|
const o = optionsWithDefaults(opts);
|
|
1140
|
-
const raw = [];
|
|
1141
|
-
try {
|
|
1142
|
-
const arr = await (await native()).getGioMountPoints?.();
|
|
1143
|
-
debug("[getLinuxMountPoints] GIO mount points: %o", arr);
|
|
1144
|
-
if (arr != null) raw.push(...arr);
|
|
1145
|
-
} catch (error) {
|
|
1146
|
-
debug("Failed to get GIO mount points: %s", error);
|
|
1147
|
-
}
|
|
1148
1135
|
let cause;
|
|
1149
1136
|
for (const input of o.linuxMountTablePaths) {
|
|
1150
1137
|
try {
|
|
1151
1138
|
const mtabContent = await readFile(input, "utf8");
|
|
1152
|
-
const
|
|
1153
|
-
debug("[getLinuxMountPoints] %s mount points: %o", input,
|
|
1154
|
-
if (
|
|
1155
|
-
|
|
1156
|
-
break;
|
|
1139
|
+
const results = parseMtab(mtabContent).map((ea) => mountEntryToMountPoint(ea)).filter((ea) => ea != null);
|
|
1140
|
+
debug("[getLinuxMountPoints] %s mount points: %o", input, results);
|
|
1141
|
+
if (results.length > 0) {
|
|
1142
|
+
return results;
|
|
1157
1143
|
}
|
|
1158
1144
|
} catch (error) {
|
|
1159
1145
|
cause ??= toError(error);
|
|
1160
1146
|
}
|
|
1161
1147
|
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
if (isMountPoint(merged)) {
|
|
1167
|
-
byMountPoint.set(merged.mountPoint, merged);
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
if (byMountPoint.size === 0) {
|
|
1171
|
-
throw new WrappedError(
|
|
1172
|
-
`Failed to find any mount points (tried: ${JSON.stringify(o.linuxMountTablePaths)})`,
|
|
1173
|
-
{ cause }
|
|
1174
|
-
);
|
|
1175
|
-
}
|
|
1176
|
-
const results = [...byMountPoint.values()];
|
|
1177
|
-
debug("[getLinuxMountPoints] %o", {
|
|
1178
|
-
results: results.map((ea) => ea.mountPoint)
|
|
1179
|
-
});
|
|
1180
|
-
return results;
|
|
1148
|
+
throw new WrappedError(
|
|
1149
|
+
`Failed to find any mount points (tried: ${JSON.stringify(o.linuxMountTablePaths)})`,
|
|
1150
|
+
{ cause }
|
|
1151
|
+
);
|
|
1181
1152
|
}
|
|
1182
1153
|
async function getLinuxMtabMetadata(mountPoint, opts) {
|
|
1183
1154
|
let caughtError;
|
|
@@ -1304,7 +1275,7 @@ async function _getVolumeMountPoints(o, nativeFn2) {
|
|
|
1304
1275
|
points.length
|
|
1305
1276
|
);
|
|
1306
1277
|
return points;
|
|
1307
|
-
})() : getLinuxMountPoints(
|
|
1278
|
+
})() : getLinuxMountPoints(o));
|
|
1308
1279
|
debug("[getVolumeMountPoints] raw mount points: %o", raw);
|
|
1309
1280
|
const compacted = raw.map((ea) => compactValues(ea)).filter((ea) => isNotBlank(ea.mountPoint));
|
|
1310
1281
|
for (const ea of compacted) {
|