@photostructure/fs-metadata 0.9.0 → 1.0.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 +15 -0
- package/README.md +7 -7
- package/binding.gyp +36 -32
- package/claude.sh +4 -1
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
- 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/src/hidden.ts +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@photostructure/fs-metadata",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Cross-platform native filesystem metadata retrieval for Node.js",
|
|
5
5
|
"homepage": "https://photostructure.github.io/fs-metadata/",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -96,29 +96,29 @@
|
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@types/jest": "^30.0.0",
|
|
99
|
-
"@types/node": "^25.0
|
|
99
|
+
"@types/node": "^25.3.0",
|
|
100
100
|
"@types/semver": "^7.7.1",
|
|
101
101
|
"cross-env": "^10.1.0",
|
|
102
102
|
"del-cli": "^7.0.0",
|
|
103
103
|
"eslint": "9.39.1",
|
|
104
|
-
"eslint-plugin-regexp": "^
|
|
105
|
-
"eslint-plugin-security": "^
|
|
106
|
-
"globals": "^
|
|
104
|
+
"eslint-plugin-regexp": "^3.0.0",
|
|
105
|
+
"eslint-plugin-security": "^4.0.0",
|
|
106
|
+
"globals": "^17.3.0",
|
|
107
107
|
"jest": "^30.2.0",
|
|
108
108
|
"jest-environment-node": "^30.2.0",
|
|
109
109
|
"jest-extended": "^7.0.0",
|
|
110
|
-
"node-gyp": "^12.
|
|
111
|
-
"npm-check-updates": "^19.
|
|
110
|
+
"node-gyp": "^12.2.0",
|
|
111
|
+
"npm-check-updates": "^19.4.1",
|
|
112
112
|
"npm-run-all2": "8.0.4",
|
|
113
113
|
"prebuildify": "^6.0.1",
|
|
114
|
-
"prettier": "^3.
|
|
114
|
+
"prettier": "^3.8.1",
|
|
115
115
|
"prettier-plugin-organize-imports": "4.3.0",
|
|
116
|
-
"terser": "^5.
|
|
116
|
+
"terser": "^5.46.0",
|
|
117
117
|
"ts-jest": "^29.4.6",
|
|
118
118
|
"tsup": "^8.5.1",
|
|
119
119
|
"tsx": "^4.21.0",
|
|
120
|
-
"typedoc": "^0.28.
|
|
120
|
+
"typedoc": "^0.28.17",
|
|
121
121
|
"typescript": "^5.9.3",
|
|
122
|
-
"typescript-eslint": "^8.
|
|
122
|
+
"typescript-eslint": "^8.56.1"
|
|
123
123
|
}
|
|
124
124
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/hidden.ts
CHANGED
|
@@ -54,6 +54,20 @@ export async function isHiddenImpl(
|
|
|
54
54
|
throw new Error("Invalid pathname: " + JSON.stringify(pathname));
|
|
55
55
|
}
|
|
56
56
|
debug("Normalized path: %s", norm);
|
|
57
|
+
|
|
58
|
+
// Root directories are never meaningfully "hidden" on any platform.
|
|
59
|
+
// Windows sets FILE_ATTRIBUTE_HIDDEN + FILE_ATTRIBUTE_SYSTEM on root drives
|
|
60
|
+
// (e.g. C:\) as a protective measure, not user intent to hide the directory.
|
|
61
|
+
// Recovery partitions are hidden at the volume level via diskpart attributes
|
|
62
|
+
// (NODEFAULTDRIVELETTER / GPT type GUIDs), not file attributes, so any root
|
|
63
|
+
// directory reachable by path is safe to treat as non-hidden.
|
|
64
|
+
// See https://learn.microsoft.com/en-us/answers/questions/427448/how-to-properly-hide-a-recovery-partition
|
|
65
|
+
// and https://en.wikipedia.org/wiki/File_attribute
|
|
66
|
+
if (isRootDirectory(norm)) {
|
|
67
|
+
debug("Root directory, returning false");
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
debug(
|
|
58
72
|
"LocalSupport: dotPrefix=%s, systemFlag=%s",
|
|
59
73
|
LocalSupport.dotPrefix,
|
|
@@ -160,6 +174,17 @@ export async function getHiddenMetadataImpl(
|
|
|
160
174
|
if (norm == null) {
|
|
161
175
|
throw new Error("Invalid pathname: " + JSON.stringify(pathname));
|
|
162
176
|
}
|
|
177
|
+
// Root directories are never meaningfully "hidden" on any platform
|
|
178
|
+
// (see comment in isHiddenImpl for details).
|
|
179
|
+
if (isRootDirectory(norm)) {
|
|
180
|
+
return {
|
|
181
|
+
hidden: false,
|
|
182
|
+
dotPrefix: false,
|
|
183
|
+
systemFlag: false,
|
|
184
|
+
supported: LocalSupport,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
163
188
|
const dotPrefix = isPosixHidden(norm);
|
|
164
189
|
const systemFlag = await isSystemHidden(norm, nativeFn);
|
|
165
190
|
return {
|