Gangmax Blog

SingleFile CLI

SingleFile CLI“ is a CLI tool to download the whole HTML page with its resources into one single file. To run it, you need “node.js” and a browser like “Firefox” installed. Here are the instructions how to make it work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Download and install "single-file-cli".
git clone https://github.com/gildas-lormeau/single-file-cli.git
cd single-file-cli
npm install
chmod +x single-file
./single-file https://en.wikipedia.org/wiki/Main_Page /media/sf_exchange/wikipedia_main_page.html --back-end=webdriver-gecko
# Download "geckodriver" as prompted in the error message when running the
# command "./single-file ..." directly.
# The geckodriver executable could not be found on the current PATH. Please
# download the latest version from https://github.com/mozilla/geckodriver/releases/
# and ensure it can be found on your PATH.
# URL: https://en.wikipedia.org/wiki/Main_Page
# Stack: Error: The geckodriver executable could not be found on the current
# PATH. Please download the latest version from
# https://github.com/mozilla/geckodriver/releases/ and ensure it can be found
# on your PATH.
# Download the binary package for your OS from "https://github.com/mozilla/geckodriver/releases/"
# and put it in the current directory(in my case it's
# "https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz").
# Run.
./single-file https://en.wikipedia.org/wiki/Main_Page \
/media/sf_exchange/wikipedia_main_page.html \
--browser-executable-path ./geckodriver \
--back-end=webdriver-gecko
# Another example:
./single-file https://en.wikipedia.org/wiki/Lake_Estancia \
/media/sf_exchange/Lake_Estancia.html \
--browser-executable-path ./geckodriver \
--back-end=webdriver-gecko \
--browser-wait-delay 20000 \
--include-infobar true

Comments