@firecrawl/anydoc-wasm 0.2.3 → 0.2.4
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/README.md +3 -2
- package/anydoc_wasm.d.ts +16 -2
- package/anydoc_wasm.js +4 -0
- package/anydoc_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Calls are synchronous: wasm runs single-threaded on the calling thread, so conve
|
|
|
36
36
|
|
|
37
37
|
## Errors
|
|
38
38
|
|
|
39
|
-
A conversion throws only when no
|
|
39
|
+
A conversion throws only when no complete Markdown could come out of the bytes. The thrown value is an `Error` whose `code` names what went wrong:
|
|
40
40
|
|
|
41
41
|
```js
|
|
42
42
|
try {
|
|
@@ -53,7 +53,8 @@ try {
|
|
|
53
53
|
|
|
54
54
|
| `code` | Meaning |
|
|
55
55
|
| --------------- | ------------------------------------------------------------------- |
|
|
56
|
-
| `unsupported` | Unknown format, or one that cannot be converted
|
|
56
|
+
| `unsupported` | Unknown format, or one that cannot be converted |
|
|
57
|
+
| `needsOcr` | Pages of a PDF are scanned or image-only; `pages` names them |
|
|
57
58
|
| `malformed` | Structurally unusable: no meaningful content could be extracted |
|
|
58
59
|
| `encrypted` | Encrypted or password-protected |
|
|
59
60
|
| `resourceLimit` | Crossed a fixed safety limit (decompression, nesting, node count) |
|
package/anydoc_wasm.d.ts
CHANGED
|
@@ -10,13 +10,18 @@ export type Format = "doc" | "docx" | "odt" | "pdf" | "ppt" | "pptx" | "rtf" | "
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* `code` on the `Error` a failed conversion throws. Conversion fails only
|
|
13
|
-
* when no
|
|
13
|
+
* when no complete Markdown could be produced; producer quirks are
|
|
14
14
|
* recovered or skipped instead. The crate's `io` code has no wasm
|
|
15
15
|
* counterpart: there is no filesystem to read from.
|
|
16
16
|
*/
|
|
17
17
|
export type ConvertErrorCode =
|
|
18
|
-
/** Unknown format, or one that cannot be converted
|
|
18
|
+
/** Unknown format, or one that cannot be converted. */
|
|
19
19
|
| 'unsupported'
|
|
20
|
+
/**
|
|
21
|
+
* Pages of a PDF are scanned or image-only and need OCR, which anydoc does
|
|
22
|
+
* not do. The error is a `NeedsOcrError` naming them.
|
|
23
|
+
*/
|
|
24
|
+
| 'needsOcr'
|
|
20
25
|
/** Structurally unusable: no meaningful content could be extracted. */
|
|
21
26
|
| 'malformed'
|
|
22
27
|
/** Encrypted or password-protected. */
|
|
@@ -26,6 +31,15 @@ export type ConvertErrorCode =
|
|
|
26
31
|
/** A part required for any meaningful output is absent. */
|
|
27
32
|
| 'missingPart'
|
|
28
33
|
|
|
34
|
+
/** The error thrown for a PDF with pages that need OCR. */
|
|
35
|
+
export interface NeedsOcrError extends Error {
|
|
36
|
+
code: 'needsOcr'
|
|
37
|
+
/** 1-indexed pages that need OCR. */
|
|
38
|
+
pages: number[]
|
|
39
|
+
/** Pages in the document. */
|
|
40
|
+
pageCount: number
|
|
41
|
+
}
|
|
42
|
+
|
|
29
43
|
export interface Document {
|
|
30
44
|
blocks: Array<Block>
|
|
31
45
|
/**
|
package/anydoc_wasm.js
CHANGED
|
@@ -141,6 +141,10 @@ function __wbg_get_imports() {
|
|
|
141
141
|
const ret = new Object();
|
|
142
142
|
return addHeapObject(ret);
|
|
143
143
|
},
|
|
144
|
+
__wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
|
|
145
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
146
|
+
return ret;
|
|
147
|
+
},
|
|
144
148
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
145
149
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
146
150
|
},
|
package/anydoc_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@firecrawl/anydoc-wasm",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "WebAssembly bindings for anydoc: convert documents (doc, docx, odt, rtf, epub, pdf, presentations, spreadsheets, csv) to GitHub-Flavored Markdown in the browser",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.4",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|