@iyulab/unpdf 0.17.0 → 0.18.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/README.md CHANGED
@@ -10,12 +10,14 @@ npm install @iyulab/unpdf
10
10
 
11
11
  ## Usage
12
12
 
13
+ > This package is built with `wasm-pack --target bundler`. It is an ES module and the
14
+ > WebAssembly binary is initialised for you, so there is no `init()` to await — import
15
+ > the functions and call them. Use it through a bundler (webpack, Vite, Rollup, esbuild).
16
+
13
17
  ### Browser / Bundler (webpack, vite)
14
18
 
15
19
  ```js
16
- import init, { parse, ParseOptions } from '@iyulab/unpdf';
17
-
18
- await init();
20
+ import { parse } from '@iyulab/unpdf';
19
21
 
20
22
  const response = await fetch('document.pdf');
21
23
  const bytes = new Uint8Array(await response.arrayBuffer());
@@ -29,9 +31,7 @@ console.log(`Pages: ${doc.pageCount()}`);
29
31
  ### With Options
30
32
 
31
33
  ```js
32
- import init, { parseWithOptions, ParseOptions } from '@iyulab/unpdf';
33
-
34
- await init();
34
+ import { parseWithOptions, ParseOptions } from '@iyulab/unpdf';
35
35
 
36
36
  const opts = new ParseOptions()
37
37
  .lenient()
@@ -44,9 +44,12 @@ console.log(doc.toMarkdown());
44
44
 
45
45
  ### Node.js
46
46
 
47
+ The bundler target is an ES module, so import it rather than `require` it, and run it
48
+ through a bundler.
49
+
47
50
  ```js
48
- const { parse } = require('@iyulab/unpdf');
49
- const fs = require('fs');
51
+ import { parse } from '@iyulab/unpdf';
52
+ import fs from 'node:fs';
50
53
 
51
54
  const bytes = fs.readFileSync('document.pdf');
52
55
  const doc = parse(new Uint8Array(bytes));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@iyulab/unpdf",
3
3
  "type": "module",
4
4
  "description": "High-performance PDF extraction to Markdown, text, and JSON (WebAssembly)",
5
- "version": "0.17.0",
5
+ "version": "0.18.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
Binary file