Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/platform/wasm/examples/streams/fetch.js @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 "use strict" | |
| 2 | |
| 3 import * as mupdf from "mupdf" | |
| 4 | |
| 5 async function fetch_and_open_document(url) { | |
| 6 var response = await fetch(url) | |
| 7 if (!response.ok) | |
| 8 throw new Error(response.status + " " + response.statusText) | |
| 9 var data = await response.arrayBuffer() | |
| 10 return mupdf.Document.openDocument(data, url) | |
| 11 } | |
| 12 | |
| 13 if (process.argv.length < 3) { | |
| 14 console.error("usage: node examples/streams/fetch.js http://mupdf.com/docs/mupdf_explored.pdf") | |
| 15 } else { | |
| 16 for (var url of process.argv.slice(2)) { | |
| 17 var doc = await fetch_and_open_document(url) | |
| 18 console.log(url + " has " + doc.countPages() + " pages.") | |
| 19 } | |
| 20 } |
