@bentopdf/pymupdf-wasm 0.1.9 → 0.1.10
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/dist/index.js +14 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1946,6 +1946,20 @@ for chunk in chunks:
|
|
|
1946
1946
|
else:
|
|
1947
1947
|
result.append({"text": str(chunk), "metadata": {"file_name": "${filename.replace(/"/g, '\\"')}"}})
|
|
1948
1948
|
|
|
1949
|
+
def make_json_safe(obj):
|
|
1950
|
+
if isinstance(obj, pymupdf.Rect):
|
|
1951
|
+
return list(obj)
|
|
1952
|
+
elif isinstance(obj, dict):
|
|
1953
|
+
return {k: make_json_safe(v) for k, v in obj.items()}
|
|
1954
|
+
elif isinstance(obj, list):
|
|
1955
|
+
return [make_json_safe(v) for v in obj]
|
|
1956
|
+
elif isinstance(obj, tuple):
|
|
1957
|
+
return [make_json_safe(v) for v in obj]
|
|
1958
|
+
else:
|
|
1959
|
+
return obj
|
|
1960
|
+
|
|
1961
|
+
result = make_json_safe(result)
|
|
1962
|
+
|
|
1949
1963
|
json.dumps(result)
|
|
1950
1964
|
`);
|
|
1951
1965
|
try {
|