fix(core): update

This commit is contained in:
2024-04-18 16:43:32 +02:00
parent 871f152f2d
commit 1ddb442661
12 changed files with 2618 additions and 31865 deletions

8
ts/00_commitinfo_data.ts Normal file
View 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.'
}

View File

@ -1 +1 @@
export * from './smartocr.classes.smartocr';
export * from './smartocr.classes.smartocr.js';

View File

@ -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;

View File

@ -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');

View File

@ -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
}