fix(core): update
This commit is contained in:
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartocr',
|
||||
version: '1.0.9',
|
||||
description: 'A module that performs optical character recognition (OCR) using ocrmypdf.'
|
||||
}
|
@ -1 +1 @@
|
||||
export * from './smartocr.classes.smartocr';
|
||||
export * from './smartocr.classes.smartocr.js';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as plugins from './smartocr.plugins';
|
||||
import * as paths from './smartocr.paths';
|
||||
import * as plugins from './smartocr.plugins.js';
|
||||
import * as paths from './smartocr.paths.js';
|
||||
|
||||
export class SmartOcr {
|
||||
// STATIC
|
||||
@ -18,10 +18,10 @@ export class SmartOcr {
|
||||
const uniqueString = plugins.smartunique.uni('doc_');
|
||||
const originalPath = plugins.path.join(paths.noGitDir, `${uniqueString}.pdf`);
|
||||
const processedPath = plugins.path.join(paths.noGitDir, `${uniqueString}_processed.pdf`);
|
||||
const originalSmartfile = await plugins.smartfile.Smartfile.fromBuffer(originalPath, pdfBufferArg);
|
||||
const originalSmartfile = await plugins.smartfile.SmartFile.fromBuffer(originalPath, pdfBufferArg);
|
||||
await originalSmartfile.write();
|
||||
await this.smartshellInstance.exec(`ocrmypdf --rotate-pages ${originalPath} ${processedPath}`);
|
||||
const processedSmartfile = await plugins.smartfile.Smartfile.fromFilePath(processedPath);
|
||||
const processedSmartfile = await plugins.smartfile.SmartFile.fromFilePath(processedPath);
|
||||
await originalSmartfile.delete();
|
||||
await processedSmartfile.delete();
|
||||
return processedSmartfile.contentBuffer;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as plugins from './smartocr.plugins';
|
||||
import * as plugins from './smartocr.plugins.js';
|
||||
|
||||
export const packageDir = plugins.path.join(__dirname, '../');
|
||||
export const packageDir = plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
|
||||
export const noGitDir = plugins.path.join(packageDir, './.nogit');
|
@ -6,14 +6,16 @@ export {
|
||||
}
|
||||
|
||||
// @pushrocks scope
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartshell from '@pushrocks/smartshell';
|
||||
import * as smartunique from '@pushrocks/smartunique';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartshell from '@push.rocks/smartshell';
|
||||
import * as smartunique from '@push.rocks/smartunique';
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
|
||||
export {
|
||||
smartfile,
|
||||
smartshell,
|
||||
smartunique,
|
||||
smartpath,
|
||||
smartpromise
|
||||
}
|
||||
|
Reference in New Issue
Block a user