@intactfile/cli 0.2.0 → 0.3.0
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/dist/index.js +22 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -45,7 +45,25 @@ const OUT_EXT = {
|
|
|
45
45
|
archive: "",
|
|
46
46
|
audio: ".wav",
|
|
47
47
|
avi: ".avi",
|
|
48
|
+
raw: ".dng",
|
|
49
|
+
psd: ".psd",
|
|
50
|
+
"office-legacy": ".doc",
|
|
48
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* When the returned bytes are a salvaged preview (not the native container),
|
|
54
|
+
* name the file honestly. RAW → embedded JPEG; PSD thumbnail-only → JPEG.
|
|
55
|
+
*/
|
|
56
|
+
function previewName(input, r) {
|
|
57
|
+
if (r.kind !== "file")
|
|
58
|
+
return null;
|
|
59
|
+
const rep = r.report;
|
|
60
|
+
const p = parse(input);
|
|
61
|
+
if (r.family === "raw" && rep.previewSource != null)
|
|
62
|
+
return join(p.dir, `${p.name}.preview.jpg`);
|
|
63
|
+
if (r.family === "psd" && rep.output === "jpeg")
|
|
64
|
+
return join(p.dir, `${p.name}.thumbnail.jpg`);
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
49
67
|
function defaultOut(input, family) {
|
|
50
68
|
const p = parse(input);
|
|
51
69
|
const ext = p.ext || OUT_EXT[family];
|
|
@@ -84,7 +102,10 @@ function writeResult(input, out, r) {
|
|
|
84
102
|
}
|
|
85
103
|
return written;
|
|
86
104
|
}
|
|
87
|
-
|
|
105
|
+
// A salvaged preview (RAW embedded JPEG, PSD thumbnail) is not the native
|
|
106
|
+
// container — name it honestly instead of dressing it up.
|
|
107
|
+
const preview = out ? null : previewName(input, r);
|
|
108
|
+
const dest = preview ?? out ?? defaultOut(input, r.family);
|
|
88
109
|
writeFileSync(dest, r.bytes);
|
|
89
110
|
return [dest];
|
|
90
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intactfile/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "IntactFile CLI — repair corrupted files locally (video, ZIP/Office, PDF, JPEG, PNG, SQLite, RAR/7z). Your files never leave your machine. Business plan for repairs; diagnosis is free.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"commander": "^12.1.0",
|
|
18
|
-
"@intactfile/node-core": "0.
|
|
18
|
+
"@intactfile/node-core": "0.3.0",
|
|
19
19
|
"@intactfile/report": "0.1.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|