@lyra_wang/dsh-image-ocr 0.2.0 → 0.2.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/index.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -135,7 +135,7 @@ export function apply(ctx) {
|
|
|
135
135
|
const buffer = Buffer.from(base64, 'base64');
|
|
136
136
|
if (buffer.length === 0) throw new Error('图片数据为空');
|
|
137
137
|
if (buffer.length > 12 * 1024 * 1024) throw new Error('图片太大(上限 12MB)');
|
|
138
|
-
tempPath = join(
|
|
138
|
+
tempPath = join(tmpdir(), 'dsh-image-ocr-' + Date.now() + '-' + Math.random().toString(16).slice(2, 8) + '.png');
|
|
139
139
|
writeFileSync(tempPath, buffer);
|
|
140
140
|
}
|
|
141
141
|
const text = await runOcr(binary, tempPath);
|
package/package.json
CHANGED