Skip to content

@stephansama/single-file

Fetch any webpage and produce a fully self-contained HTML file with all external resources — images, stylesheets, scripts, and SVGs — inlined directly into the document.

Open Table of contents
Terminal window
pnpm install @stephansama/single-file
Terminal window
# outputs to single-file.html by default
npx @stephansama/single-file <url>
# custom output path
npx @stephansama/single-file <url> --output my-page.html
npx @stephansama/single-file <url> -o my-page.html
# verbose logging
npx @stephansama/single-file <url> --verbose
npx @stephansama/single-file <url> -v
FlagAliasDefaultDescription
--output-osingle-file.htmlOutput path for the HTML file
--verbose-vfalseEnable verbose output
import * as singleFile from "@stephansama/single-file";
export async function useAPI() {
const file = await singleFile.convertPageToSingleFile(
"https://blog.stephansama.info",
);
console.info(file);
}
Module Description

cli

convert

import-map

index

inline

log

utilities