@krizpoon/hangseng-statement-extractor 0.1.0 → 0.1.1
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 +17 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,14 +14,14 @@ Extract transaction history from Hang Seng Bank statement PDFs using a small Typ
|
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
```bash
|
|
17
|
-
npm install hangseng-statement-extractor
|
|
17
|
+
npm install @krizpoon/hangseng-statement-extractor
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## CLI
|
|
21
|
-
The CLI requires all paths to be provided explicitly.
|
|
22
21
|
|
|
22
|
+
Run directly with `npx` (no install needed):
|
|
23
23
|
```bash
|
|
24
|
-
hangseng-statement-extractor \
|
|
24
|
+
npx @krizpoon/hangseng-statement-extractor \
|
|
25
25
|
--input /path/to/statement.pdf \
|
|
26
26
|
--account savings \
|
|
27
27
|
--output /path/to/output.csv
|
|
@@ -29,34 +29,27 @@ hangseng-statement-extractor \
|
|
|
29
29
|
|
|
30
30
|
Process a directory of PDFs:
|
|
31
31
|
```bash
|
|
32
|
-
hangseng-statement-extractor \
|
|
32
|
+
npx @krizpoon/hangseng-statement-extractor \
|
|
33
33
|
--input /path/to/statements/ \
|
|
34
34
|
--account savings \
|
|
35
35
|
--output /path/to/output.csv
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
- `--
|
|
40
|
-
- `--account`
|
|
38
|
+
Options:
|
|
39
|
+
- `--input` (required) — PDF file or directory containing PDFs.
|
|
40
|
+
- `--account` — `savings` (default) or `current`.
|
|
41
|
+
- `--output` — Output CSV file. If omitted, CSV is printed to stdout.
|
|
42
|
+
- `--python` — Path to Python executable. Auto-detected if not specified.
|
|
43
|
+
- `--verbose` — Enable verbose logging.
|
|
41
44
|
|
|
42
45
|
## Library Usage
|
|
43
46
|
```ts
|
|
44
|
-
import { extractStatement, formatTransactionsAsCsv } from "hangseng-statement-extractor"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const pythonPath = "/usr/bin/python3"
|
|
51
|
-
const scriptPath = join(
|
|
52
|
-
here,
|
|
53
|
-
"../node_modules/hangseng-statement-extractor/scripts/pdf-extract-positions.py",
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
const result = extractStatement({
|
|
57
|
-
pdfPath,
|
|
58
|
-
scriptPath,
|
|
59
|
-
pythonPath,
|
|
47
|
+
import { extractStatement, formatTransactionsAsCsv } from "@krizpoon/hangseng-statement-extractor"
|
|
48
|
+
|
|
49
|
+
const result = await extractStatement({
|
|
50
|
+
pdfPath: "/path/to/statement.pdf",
|
|
51
|
+
scriptPath: "/path/to/pdf-extract-positions.py",
|
|
52
|
+
pythonPath: "python3",
|
|
60
53
|
accountType: "savings",
|
|
61
54
|
})
|
|
62
55
|
|
|
@@ -65,7 +58,7 @@ console.log(csv)
|
|
|
65
58
|
```
|
|
66
59
|
|
|
67
60
|
### API
|
|
68
|
-
- `extractStatement(options)`
|
|
61
|
+
- `extractStatement(options)` — Returns `Promise<StatementResult>`
|
|
69
62
|
- `options.pdfPath` (string)
|
|
70
63
|
- `options.scriptPath` (string)
|
|
71
64
|
- `options.pythonPath` (string)
|