Skip to content

About

Node.js console utility for downloading web pages with local assets (img, link, script) of a given domain and subdomains

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Page-loader

Tests and linter status:

Actions Status Node CI Maintainability Test Coverage

Description:

Node.js console utility for downloading web pages with local assets (img, link, script) of a given domain and subdomains

Installation:

make build

Usage:

Usage: page-loader [options] <url>

Downloading web pages with local assets

Options:
  -V, --version       output the version number
  -o, --output [dir]  output dir (default: "/your/current/dir")
  -h, --help          output usage information

Demo video:

asciicast

Example:

Before:

web page with URL https://ru.hexlet.io/courses:

<!doctype html>
<html lang="ru">
  <head>
    <meta charset="utf-8" />
    <title>Курсы по программированию Хекслет</title>
    <link rel="stylesheet" media="all" href="https://cdn2.hexlet.io/assets/menu.css" />
    <link rel="stylesheet" media="all" href="/assets/application.css" />
    <link href="/courses" rel="canonical" />
  </head>
  <body>
    <img src="/assets/professions/nodejs.png" alt="Иконка профессии Node.js-программист" />
    <h3>
      <a href="/professions/nodejs">Node.js-программист</a>
    </h3>
    <script src="https://js.stripe.com/v3/"></script>
    <script src="https://ru.hexlet.io/packs/js/runtime.js"></script>
  </body>
</html>

Your output dir:

tree
.

0 directories, 0 files

Comand:

page-loader https://ru.hexlet.io/courses

After:

Local file ru-hexlet-io-courses.html:

<!doctype html>
<html lang="ru">
  <head>
    <meta charset="utf-8" />
    <title>Курсы по программированию Хекслет</title>
    <link rel="stylesheet" media="all" href="https://cdn2.hexlet.io/assets/menu.css" />
    <link
      rel="stylesheet"
      media="all"
      href="ru-hexlet-io-courses_files/ru-hexlet-io-assets-application.css"
    />
    <link href="ru-hexlet-io-courses_files/ru-hexlet-io-courses.html" rel="canonical" />
  </head>
  <body>
    <img
      src="ru-hexlet-io-courses_files/ru-hexlet-io-assets-professions-nodejs.png"
      alt="Иконка профессии Node.js-программист"
    />
    <h3>
      <a href="/professions/nodejs">Node.js-программист</a>
    </h3>
    <script src="https://js.stripe.com/v3/"></script>
    <script src="ru-hexlet-io-courses_files/ru-hexlet-io-packs-js-runtime.js"></script>
  </body>
</html>

Your output dir:

tree
.
├── ru-hexlet-io-courses.html
└── ru-hexlet-io-courses_files
    ├── ru-hexlet-io-assets-application.css
    ├── ru-hexlet-io-assets-professions-nodejs.png
    ├── ru-hexlet-io-courses.html
    └── ru-hexlet-io-packs-js-runtime.js

1 directory, 5 files

Logging:

#axios debug:
DEBUG=page-loader:axios ...

#nock debug:
DEBUG=page-loader:nock ...

asciicast

Linting and testing:

#testing:
npm test
make test-coverage

#linting:
make lint

About

Node.js console utility for downloading web pages with local assets (img, link, script) of a given domain and subdomains

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages