@mostajs/file-content-reader 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog — @mostajs/file-content-reader
2
+
3
+ **Auteur** : Dr Hamid MADANI <drmdh@msn.com>
4
+
5
+ ## 0.1.0 — 2026-06-10
6
+ - Scaffold (cas C) après livrables DEVRULES **#1 (étude), #2 (audit), #3 (plan)** + script de recherche §8 (`docs/`).
7
+ - Lecture du **contenu texte** d'un fichier (octets → texte), **un lecteur (dialecte) par format** (façon dialects ORM) :
8
+ `extractText({bytes, filename?, mime?, format?}, {maxChars?})`, `availableFormats()`, `getSupportedFormats()`, `detectFormat()`, `registerReader`/`getReader`.
9
+ - **`text`** (txt/md/log), **`csv`**, **`html`** (strip-tags) : zéro dépendance (purs).
10
+ - **`pdf`** (driver `pdf-parse`), **`docx`** (driver `mammoth`) : libs npm **in-memory, lazy** ; `available()` + `installHint` (façon ORM « requires a driver »).
11
+ - **Module fs-free** : reçoit des octets (fournis par `@mostajs/storage`), ne touche pas au disque. **Pendant LECTURE de `@mostajs/file-export`**.
12
+ - Détection de format par extension/mime ; troncature (`maxChars`) pour borner le contexte LLM.
13
+ - Test `test-scripts/run-extract-test.sh` (txt/md/csv/html validés sans dépendance ; pdf/docx selon drivers installés).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ @mostajs/i18n
2
+ Copyright (C) 2026 Dr Hamid MADANI <drmdh@msn.com>
3
+
4
+ SPDX-License-Identifier: AGPL-3.0-or-later
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU Affero General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU Affero General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Affero General Public License
17
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
18
+
19
+ The complete text of the GNU Affero General Public License version 3 is
20
+ available at the URL above and must accompany any distribution of this
21
+ software.
package/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # @mostajs/file-content-reader
2
+
3
+ Lecture du **contenu texte** d'un fichier (octets → texte) pour les apps `@mostajs/*`, avec **un dialecte
4
+ par format** (façon dialects [`@mostajs/orm`](https://www.npmjs.com/package/@mostajs/orm)) : `txt`, `md`,
5
+ `csv`, `html` (zéro dép) ; `pdf` (`pdf-parse`), `docx` (`mammoth`). **Pendant lecture** de
6
+ [`@mostajs/file-export`](https://www.npmjs.com/package/@mostajs/file-export).
7
+
8
+ **Auteur** : Dr Hamid MADANI <drmdh@msn.com> · **Licence** : AGPL-3.0-or-later
9
+
10
+ ## Principes
11
+ - **fs-free** : reçoit des **octets** (fournis par [`@mostajs/storage`](https://www.npmjs.com/package/@mostajs/storage)) et rend du texte. Ne touche **jamais** au disque.
12
+ - `txt`/`md`/`csv`/`html` : **zéro dépendance**. `pdf`/`docx` : drivers npm **optionnels, lazy** (`pdf-parse`, `mammoth`).
13
+
14
+ ## Usage
15
+ ```ts
16
+ import { extractText, availableFormats } from "@mostajs/file-content-reader";
17
+
18
+ // bytes obtenus via @mostajs/storage (readFileById → stream → Uint8Array)
19
+ const { text, format, truncated } = await extractText({ bytes, filename: "specs.pdf" }, { maxChars: 8000 });
20
+
21
+ await availableFormats(); // formats réellement lisibles ici (drivers présents)
22
+ ```
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Lecteur `docx` — driver `mammoth` (lazy, in-memory ; extractRawText).
3
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
4
+ */
5
+ import type { IContentReader } from "../types.js";
6
+ export declare const docxReader: IContentReader;
7
+ //# sourceMappingURL=docx.d.ts.map
@@ -0,0 +1,18 @@
1
+ export const docxReader = {
2
+ format: "docx", label: "Word (DOCX)", extensions: ["docx"],
3
+ mimes: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
4
+ driver: { module: "mammoth", installHint: "npm install mammoth" },
5
+ async available() { try {
6
+ await import("mammoth");
7
+ return true;
8
+ }
9
+ catch {
10
+ return false;
11
+ } },
12
+ async extract(bytes) {
13
+ const mammoth = await import("mammoth");
14
+ const res = await mammoth.extractRawText({ buffer: Buffer.from(bytes) });
15
+ return (res.value ?? "").trim();
16
+ },
17
+ };
18
+ //# sourceMappingURL=docx.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Lecteur `image` — lit le TEXTE d'une image (png/jpg/webp/…) via le fournisseur OCR injecté
3
+ * (`setOcrProvider`). Sans fournisseur, le format est « indisponible » (dégradation gracieuse).
4
+ * Le module ne dépend d'aucun moteur : la reconnaissance est déléguée (DI vers @mostajs/ocr).
5
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
6
+ */
7
+ import type { IContentReader } from "../types.js";
8
+ export declare const imageReader: IContentReader;
9
+ //# sourceMappingURL=image.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { getOcrProvider } from "../ocr.js";
2
+ export const imageReader = {
3
+ format: "image",
4
+ label: "Image (OCR)",
5
+ extensions: ["png", "jpg", "jpeg", "webp", "gif", "bmp", "tif", "tiff"],
6
+ mimes: ["image/png", "image/jpeg", "image/webp", "image/gif", "image/bmp", "image/tiff"],
7
+ driver: { module: "@mostajs/ocr", installHint: "setOcrProvider(...) composant @mostajs/ocr" },
8
+ available() { return !!getOcrProvider(); },
9
+ async extract(bytes) {
10
+ const ocr = getOcrProvider();
11
+ if (!ocr)
12
+ throw new Error("lecture d'image indisponible : aucun fournisseur OCR injecté (setOcrProvider)");
13
+ return (await ocr(bytes, { format: "image" }))?.trim() ?? "";
14
+ },
15
+ };
16
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Lecteur `pdf` — driver `pdf-parse` (lazy, in-memory). Compatible v1 (default fonction) ET v2
3
+ * (classe `PDFParse` + `getText()`). Façon dialect ORM « requires a driver ».
4
+ *
5
+ * REPLI OCR : si la couche texte est vide/quasi-vide (PDF scanné, composé d'images) ET qu'un
6
+ * fournisseur OCR a été injecté (`setOcrProvider`), on lui délègue les octets → texte.
7
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
8
+ */
9
+ import type { IContentReader } from "../types.js";
10
+ export declare const pdfReader: IContentReader;
11
+ //# sourceMappingURL=pdf.d.ts.map
@@ -0,0 +1,58 @@
1
+ import { getOcrProvider, OCR_TEXT_THRESHOLD } from "../ocr.js";
2
+ async function extractTextLayer(bytes) {
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ const mod = (await import("pdf-parse"));
5
+ if (typeof mod.default === "function") { // pdf-parse v1
6
+ const r = await mod.default(Buffer.from(bytes));
7
+ return String(r?.text ?? "").trim();
8
+ }
9
+ const PDFParse = mod.PDFParse ?? mod.default?.PDFParse; // pdf-parse v2
10
+ if (!PDFParse)
11
+ throw new Error("API pdf-parse non reconnue");
12
+ const parser = new PDFParse({ data: bytes });
13
+ try {
14
+ const r = await parser.getText();
15
+ return String(r?.text ?? "").trim();
16
+ }
17
+ finally {
18
+ try {
19
+ await parser.destroy?.();
20
+ }
21
+ catch { /* ignore */ }
22
+ }
23
+ }
24
+ export const pdfReader = {
25
+ format: "pdf", label: "PDF", extensions: ["pdf"], mimes: ["application/pdf"],
26
+ driver: { module: "pdf-parse", installHint: "npm install pdf-parse" },
27
+ // Disponible si pdf-parse OU un fournisseur OCR est présent (un PDF scanné est lisible par OCR seul).
28
+ async available() { if (getOcrProvider())
29
+ return true; try {
30
+ await import("pdf-parse");
31
+ return true;
32
+ }
33
+ catch {
34
+ return false;
35
+ } },
36
+ async extract(bytes) {
37
+ // pdf-parse (→ pdfjs) DÉTACHE le buffer d'entrée : on garde une copie intacte pour l'OCR.
38
+ const ocr = getOcrProvider();
39
+ const forOcr = ocr ? bytes.slice() : null;
40
+ let text = "";
41
+ try {
42
+ text = await extractTextLayer(bytes);
43
+ }
44
+ catch {
45
+ text = "";
46
+ }
47
+ if (text.length >= OCR_TEXT_THRESHOLD)
48
+ return text;
49
+ // Couche texte absente/quasi-vide → repli OCR injecté (PDF scanné).
50
+ if (ocr && forOcr) {
51
+ const t = (await ocr(forOcr, { format: "pdf" }))?.trim();
52
+ if (t)
53
+ return t;
54
+ }
55
+ return text;
56
+ },
57
+ };
58
+ //# sourceMappingURL=pdf.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Lecteurs purs (zéro dépendance) : texte (txt/md/log), csv, html. Author: Dr Hamid MADANI <drmdh@msn.com>
3
+ * @license AGPL-3.0-or-later
4
+ */
5
+ import type { IContentReader } from "../types.js";
6
+ export declare const textReader: IContentReader;
7
+ export declare const csvReader: IContentReader;
8
+ export declare const htmlReader: IContentReader;
9
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { decode, stripHtml } from "../util.js";
2
+ export const textReader = {
3
+ format: "text", label: "Texte (txt/md)", extensions: ["txt", "md", "markdown", "log", "text"],
4
+ mimes: ["text/plain", "text/markdown"], driver: null,
5
+ available() { return true; },
6
+ async extract(bytes) { return decode(bytes); },
7
+ };
8
+ export const csvReader = {
9
+ format: "csv", label: "CSV", extensions: ["csv", "tsv"], mimes: ["text/csv", "text/tab-separated-values"], driver: null,
10
+ available() { return true; },
11
+ async extract(bytes) { return decode(bytes); },
12
+ };
13
+ export const htmlReader = {
14
+ format: "html", label: "HTML", extensions: ["html", "htm"], mimes: ["text/html", "application/xhtml+xml"], driver: null,
15
+ available() { return true; },
16
+ async extract(bytes) { return stripHtml(decode(bytes)); },
17
+ };
18
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @mostajs/file-content-reader — point d'entrée. Octets → texte, un lecteur (dialecte) par format.
3
+ * Importer enregistre les lecteurs built-in (effet de bord). **fs-free** : les octets sont fournis par
4
+ * le consommateur (typiquement via @mostajs/storage) ; le module ne touche pas au disque.
5
+ *
6
+ * Usage : const { text } = await extractText({ bytes, filename: "specs.pdf" }, { maxChars: 8000 });
7
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
8
+ */
9
+ import type { ExtractInput, ExtractResult } from "./types.js";
10
+ import { textReader, csvReader, htmlReader } from "./dialects/text.js";
11
+ import { pdfReader } from "./dialects/pdf.js";
12
+ import { docxReader } from "./dialects/docx.js";
13
+ import { imageReader } from "./dialects/image.js";
14
+ export interface ExtractOptions {
15
+ maxChars?: number;
16
+ }
17
+ /** Extrait le texte d'un fichier. Détecte le format (format explicite > extension/mime). Tronque à `maxChars`. */
18
+ export declare function extractText(input: ExtractInput, opts?: ExtractOptions): Promise<ExtractResult>;
19
+ /** Formats actuellement lisibles ici (driver présent). */
20
+ export declare function availableFormats(): Promise<string[]>;
21
+ export type { ExtractInput, ExtractResult, IContentReader } from "./types.js";
22
+ export { registerReader, getReader, listReaders, getSupportedFormats, detectFormat } from "./registry.js";
23
+ export { textReader, csvReader, htmlReader, pdfReader, docxReader, imageReader };
24
+ export { setOcrProvider, getOcrProvider, OCR_TEXT_THRESHOLD } from "./ocr.js";
25
+ export type { OcrProvider, OcrContext } from "./ocr.js";
26
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ import { registerReader, getReader, listReaders, getSupportedFormats, detectFormat } from "./registry.js";
2
+ import { textReader, csvReader, htmlReader } from "./dialects/text.js";
3
+ import { pdfReader } from "./dialects/pdf.js";
4
+ import { docxReader } from "./dialects/docx.js";
5
+ import { imageReader } from "./dialects/image.js";
6
+ registerReader(textReader);
7
+ registerReader(csvReader);
8
+ registerReader(htmlReader);
9
+ registerReader(pdfReader);
10
+ registerReader(docxReader);
11
+ registerReader(imageReader);
12
+ /** Extrait le texte d'un fichier. Détecte le format (format explicite > extension/mime). Tronque à `maxChars`. */
13
+ export async function extractText(input, opts = {}) {
14
+ const format = input.format || detectFormat(input.filename, input.mime);
15
+ if (!format)
16
+ throw new Error(`format non détecté (filename=${input.filename ?? "?"}, mime=${input.mime ?? "?"}) — formats : ${getSupportedFormats().join(", ")}`);
17
+ const reader = getReader(format);
18
+ if (!reader)
19
+ throw new Error(`format « ${format} » non supporté (${getSupportedFormats().join(", ")})`);
20
+ if (!(await reader.available()))
21
+ throw new Error(`lecture « ${format} » indisponible : ${reader.driver?.installHint ?? "driver requis"}`);
22
+ let text = await reader.extract(input.bytes);
23
+ const max = opts.maxChars ?? 0;
24
+ const truncated = max > 0 && text.length > max;
25
+ if (truncated)
26
+ text = text.slice(0, max) + "\n…[tronqué]";
27
+ return { text, format, chars: text.length, truncated };
28
+ }
29
+ /** Formats actuellement lisibles ici (driver présent). */
30
+ export async function availableFormats() {
31
+ const out = [];
32
+ for (const r of listReaders())
33
+ if (await r.available())
34
+ out.push(r.format);
35
+ return out;
36
+ }
37
+ export { registerReader, getReader, listReaders, getSupportedFormats, detectFormat } from "./registry.js";
38
+ export { textReader, csvReader, htmlReader, pdfReader, docxReader, imageReader };
39
+ // OCR injectable (DI) — le consommateur compose @mostajs/image + @mostajs/ocr.
40
+ export { setOcrProvider, getOcrProvider, OCR_TEXT_THRESHOLD } from "./ocr.js";
41
+ //# sourceMappingURL=index.js.map
package/dist/ocr.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @mostajs/file-content-reader — fournisseur OCR INJECTABLE (DI). Le module reste générique : il
3
+ * ne dépend NI de @mostajs/image NI de @mostajs/ocr. Le consommateur (racine de composition)
4
+ * injecte une fonction qui sait transformer des octets (PDF scanné, image) en texte — typiquement
5
+ * en composant `@mostajs/image` (rendu des pages) + `@mostajs/ocr` (reconnaissance).
6
+ *
7
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
8
+ */
9
+ /** Contexte passé au fournisseur OCR. */
10
+ export interface OcrContext {
11
+ format: string;
12
+ filename?: string;
13
+ mime?: string;
14
+ }
15
+ /** Fournisseur OCR : octets → texte (ou null si rien). */
16
+ export type OcrProvider = (bytes: Uint8Array, ctx: OcrContext) => Promise<string | null>;
17
+ /** Injecte (ou retire avec null) le fournisseur OCR global. */
18
+ export declare function setOcrProvider(fn: OcrProvider | null): void;
19
+ /** Fournisseur OCR courant (ou null). */
20
+ export declare function getOcrProvider(): OcrProvider | null;
21
+ /** Seuil sous lequel un PDF est considéré « sans couche texte » (scanné) → bascule OCR. */
22
+ export declare const OCR_TEXT_THRESHOLD = 16;
23
+ //# sourceMappingURL=ocr.d.ts.map
package/dist/ocr.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @mostajs/file-content-reader — fournisseur OCR INJECTABLE (DI). Le module reste générique : il
3
+ * ne dépend NI de @mostajs/image NI de @mostajs/ocr. Le consommateur (racine de composition)
4
+ * injecte une fonction qui sait transformer des octets (PDF scanné, image) en texte — typiquement
5
+ * en composant `@mostajs/image` (rendu des pages) + `@mostajs/ocr` (reconnaissance).
6
+ *
7
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
8
+ */
9
+ let _provider = null;
10
+ /** Injecte (ou retire avec null) le fournisseur OCR global. */
11
+ export function setOcrProvider(fn) { _provider = fn; }
12
+ /** Fournisseur OCR courant (ou null). */
13
+ export function getOcrProvider() { return _provider; }
14
+ /** Seuil sous lequel un PDF est considéré « sans couche texte » (scanné) → bascule OCR. */
15
+ export const OCR_TEXT_THRESHOLD = 16;
16
+ //# sourceMappingURL=ocr.js.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @mostajs/file-content-reader — registre de lecteurs (dialectes) + détection de format.
3
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
4
+ */
5
+ import type { IContentReader } from "./types.js";
6
+ export declare function registerReader(r: IContentReader): void;
7
+ export declare function getReader(format: string): IContentReader | null;
8
+ export declare function listReaders(): IContentReader[];
9
+ export declare function getSupportedFormats(): string[];
10
+ /** Détecte le format depuis un nom de fichier (extension) ou un type MIME. */
11
+ export declare function detectFormat(filename?: string, mime?: string): string | null;
12
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1,18 @@
1
+ const READERS = new Map();
2
+ export function registerReader(r) { READERS.set(r.format, r); }
3
+ export function getReader(format) { return READERS.get(format) ?? null; }
4
+ export function listReaders() { return Array.from(READERS.values()); }
5
+ export function getSupportedFormats() { return Array.from(READERS.keys()); }
6
+ /** Détecte le format depuis un nom de fichier (extension) ou un type MIME. */
7
+ export function detectFormat(filename, mime) {
8
+ const ext = (filename ?? "").toLowerCase().split(".").pop() ?? "";
9
+ const m = (mime ?? "").toLowerCase().split(";")[0].trim();
10
+ for (const r of READERS.values()) {
11
+ if (ext && r.extensions.includes(ext))
12
+ return r.format;
13
+ if (m && r.mimes.includes(m))
14
+ return r.format;
15
+ }
16
+ return null;
17
+ }
18
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @mostajs/file-content-reader — types. Lecture du contenu texte d'un fichier (octets → texte),
3
+ * un **dialecte par format** (façon dialects ORM). Pendant LECTURE de @mostajs/file-export.
4
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
5
+ */
6
+ /** Entrée : octets (fournis par @mostajs/storage) + indices de format (nom/mime/format explicite). */
7
+ export interface ExtractInput {
8
+ bytes: Uint8Array;
9
+ filename?: string;
10
+ mime?: string;
11
+ format?: string;
12
+ }
13
+ /** Résultat : texte extrait + format détecté + métriques. */
14
+ export interface ExtractResult {
15
+ text: string;
16
+ format: string;
17
+ chars: number;
18
+ truncated: boolean;
19
+ }
20
+ /**
21
+ * **Lecteur de contenu** (dialecte) — porte ses extensions/mimes (détection), son driver
22
+ * (`{module, installHint}` + `available()`) et `extract(bytes) → texte`. fs-free.
23
+ */
24
+ export interface IContentReader {
25
+ readonly format: string;
26
+ readonly label: string;
27
+ readonly extensions: string[];
28
+ readonly mimes: string[];
29
+ readonly driver?: {
30
+ module: string;
31
+ installHint: string;
32
+ } | null;
33
+ available(): boolean | Promise<boolean>;
34
+ extract(bytes: Uint8Array): Promise<string>;
35
+ }
36
+ //# sourceMappingURL=types.d.ts.map
package/dist/types.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mostajs/file-content-reader — types. Lecture du contenu texte d'un fichier (octets → texte),
3
+ * un **dialecte par format** (façon dialects ORM). Pendant LECTURE de @mostajs/file-export.
4
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
package/dist/util.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @mostajs/file-content-reader — utilitaires partagés.
3
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
4
+ */
5
+ export declare const decode: (bytes: Uint8Array) => string;
6
+ /** HTML → texte : retire scripts/styles + balises, décode quelques entités, normalise les blancs. */
7
+ export declare function stripHtml(html: string): string;
8
+ //# sourceMappingURL=util.d.ts.map
package/dist/util.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @mostajs/file-content-reader — utilitaires partagés.
3
+ * @author Dr Hamid MADANI <drmdh@msn.com> · AGPL-3.0-or-later
4
+ */
5
+ export const decode = (bytes) => new TextDecoder("utf-8").decode(bytes);
6
+ /** HTML → texte : retire scripts/styles + balises, décode quelques entités, normalise les blancs. */
7
+ export function stripHtml(html) {
8
+ return html
9
+ .replace(/<(script|style)[\s\S]*?<\/\1>/gi, " ")
10
+ .replace(/<\/(p|div|li|tr|h[1-6]|br)>/gi, "\n")
11
+ .replace(/<[^>]+>/g, " ")
12
+ .replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"')
13
+ .replace(/[ \t]+/g, " ").replace(/\n{3,}/g, "\n\n").trim();
14
+ }
15
+ //# sourceMappingURL=util.js.map
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@mostajs/file-content-reader",
3
+ "version": "0.1.0",
4
+ "description": "Lecture du CONTENU texte d'un fichier (octets → texte) pour apps @mostajs/* — un dialecte par format (façon dialects @mostajs/orm) : txt, md, csv, html (zéro dép) ; pdf (pdf-parse), docx (mammoth) via drivers optionnels lazy. fs-free : reçoit des octets (fournis par @mostajs/storage), ne touche pas au disque. Pendant LECTURE de @mostajs/file-export.",
5
+ "author": "Dr Hamid MADANI <drmdh@msn.com>",
6
+ "license": "AGPL-3.0-or-later",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist/**/*.js",
19
+ "dist/**/*.d.ts",
20
+ "CHANGELOG.md",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "peerDependencies": {
25
+ "pdf-parse": ">=1.1.0",
26
+ "mammoth": ">=1.6.0"
27
+ },
28
+ "peerDependenciesMeta": {
29
+ "pdf-parse": {
30
+ "optional": true
31
+ },
32
+ "mammoth": {
33
+ "optional": true
34
+ }
35
+ },
36
+ "devDependencies": {
37
+ "typescript": "^5.6.0"
38
+ },
39
+ "keywords": [
40
+ "file",
41
+ "content",
42
+ "reader",
43
+ "extract",
44
+ "text",
45
+ "pdf",
46
+ "docx",
47
+ "ocr",
48
+ "dialect",
49
+ "mostajs"
50
+ ],
51
+ "scripts": {
52
+ "build": "tsc -p tsconfig.json"
53
+ }
54
+ }