web

package
v0.0.0-...-5b41359 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

WebpackPlugin

Archives web pages from URLs into local files (webarchive or HTML format).

Type

ProcessPlugin

Version

1.0

Name

webpack

Parameters

Parameter Required Source Description
file_name Yes Request Output filename (without extension)
url Yes Request URL of the webpage to archive
file_type No PluginCall Output format: html, webarchive (default: webarchive)
clutter_free No PluginCall Remove clutter from HTML (default: true)

Note: file_type and clutter_free are read at plugin initialization time from PluginCall.Params. file_name and url are read at runtime from Request.

Output

{
  "file_path": "<filename>.<format>",
  "size": <file-size-in-bytes>,
  "title": "<page-title>",
  "url": "<original-url>"
}
Output Fields
Field Type Description
file_path string Filename of the archived page
size int64 File size in bytes
title string Page title (derived from filename)
url string Original URL

File Type Formats

Format Description
webarchive macOS Web Archive format
html Readable HTML file with clutter removed

Usage Example

# Archive webpage as webarchive (default settings)
- name: webpack
  parameters:
    file_name: "example-page"
    url: "https://example.com/article"
  working_path: "/path/to/output"

# Archive as HTML (file_type via PluginCall params)
- name: webpack
  parameters:
    file_name: "example-page"
    url: "https://example.com/article"
  with:
    file_type: "html"

# Disable clutter removal (via PluginCall params)
- name: webpack
  parameters:
    file_name: "example-page"
    url: "https://example.com/article"
  with:
    clutter_free: "false"

Environment Variables

Variable Description
WebPackerEnablePrivateNet Set to true to enable access to private network resources

Notes

  • Timeout is fixed at 60 seconds
  • Uses webpage-packer for archiving
  • Title is derived from the filename (extension stripped)

Documentation

Index

Constants

View Source
const (
	WebpackPluginName    = "webpack"
	WebpackPluginVersion = "1.0"
)

Variables

View Source
var WebpackPluginSpec = types.PluginSpec{
	Name:    WebpackPluginName,
	Version: WebpackPluginVersion,
	Type:    types.TypeProcess,
	InitParameters: []types.ParameterSpec{
		{
			Name:        "file_type",
			Required:    false,
			Default:     "webarchive",
			Description: "Output format: html, webarchive",
			Options:     []string{"html", "webarchive"},
		},
		{
			Name:        "clutter_free",
			Required:    false,
			Default:     "true",
			Description: "Enable clutter-free mode",
			Options:     []string{"true", "false"},
		},
	},
	Parameters: []types.ParameterSpec{
		{
			Name:        "file_name",
			Required:    true,
			Description: "Output file name",
		},
		{
			Name:        "url",
			Required:    true,
			Description: "URL to pack",
		},
	},
}

Functions

func NewWebpackPlugin

func NewWebpackPlugin(ps types.PluginCall) types.Plugin

func PackFromURL

func PackFromURL(ctx context.Context, filename, urlInfo, tgtFileType, outputDir string, clutterFree bool, options ...Option) (string, error)

func ParseFromFile

func ParseFromFile(ctx context.Context, filePath string) (string, error)

func ReadFromFile

func ReadFromFile(ctx context.Context, filePath string) (string, error)

Types

type Option

type Option func(option *packer.Option)

type WebpackPlugin

type WebpackPlugin struct {
	// contains filtered or unexported fields
}

func (*WebpackPlugin) Name

func (w *WebpackPlugin) Name() string

func (*WebpackPlugin) Run

func (w *WebpackPlugin) Run(ctx context.Context, request *api.Request) (*api.Response, error)

func (*WebpackPlugin) Type

func (w *WebpackPlugin) Type() types.PluginType

func (*WebpackPlugin) Version

func (w *WebpackPlugin) Version() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL