Szpadel / chrome-headless-render-pdf

225 stars 67 forks source link

automatically convert local file paths to file url #68

Open klieber opened 4 years ago

klieber commented 4 years ago

In the current version of the script you must use the syntax file:///path/to/file when referencing a local file. This works but can be difficult to work with when you simply want to build a pdf for a file in the current directory. You can do something like file://$(realpath index.html) but that is not cross platform and doesn't work in environments like Git Bash for Windows.

This change utilizes the file-url package to automatically convert local file paths to a file url. It will only do so when the provided url does not start with http, https, or file.