npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@d-zero/replicator

v0.7.7

Published

Replicate web pages with all their resources to local directories

Readme

@d-zero/replicator

ウェブページとそのリソースをレスポンシブ画像対応でローカルディレクトリに複製するツールです。複数のURLを並列処理し、効率的にリソースを取得します。

インストール

npm install @d-zero/replicator

使い方

CLI

npx @d-zero/replicator <url...> -o <output-directory> [options]

オプション

  • -o, --output <dir>: 出力ディレクトリ(必須)
  • -t, --timeout <ms>: リクエストタイムアウト(ミリ秒、デフォルト: 30000)
  • -d, --devices <devices>: デバイスプリセット(カンマ区切り、デフォルト: desktop-compact,mobile)
  • -l, --limit <number>: 並列処理数の上限(デフォルト: 3)
  • --only <type>: ダウンロード対象を限定(page または resource
  • -v, --verbose: 詳細ログモード
--only オプション
  • page: HTMLページのみをダウンロード(リソーススキャンをスキップして高速化)
  • resource: リソース(CSS、JS、画像など)のみをダウンロード(HTMLページを除外)
  • 未指定: すべてのファイルをダウンロード(デフォルト動作)

利用可能なデバイスプリセット

  • desktop: 1400px幅
  • tablet: 768px幅
  • mobile: 375px幅(2倍解像度)
  • desktop-hd: 1920px幅
  • desktop-compact: 1280px幅
  • mobile-large: 414px幅(3倍解像度)
  • mobile-small: 320px幅(2倍解像度)

使用例

# 単一URL(デフォルトデバイス: desktop-compact, mobile)
npx @d-zero/replicator https://example.com -o ./output

# 複数URLを並列処理
npx @d-zero/replicator https://example.com/page1 https://example.com/page2 -o ./output

# 並列数を制限
npx @d-zero/replicator https://example.com/page1 https://example.com/page2 -o ./output --limit 2

# カスタムデバイス指定
npx @d-zero/replicator https://example.com -o ./output --devices desktop,tablet,mobile

# タイムアウト指定
npx @d-zero/replicator https://example.com -o ./output --timeout 60000

# HTMLページのみダウンロード(高速)
npx @d-zero/replicator https://example.com -o ./output --only page

# リソースのみダウンロード(HTMLを除外)
npx @d-zero/replicator https://example.com -o ./output --only resource

プログラマティック使用

import { replicate } from '@d-zero/replicator';

// 単一URL
await replicate({
	urls: ['https://example.com'],
	outputDir: './output',
});

// 複数URLを並列処理
await replicate({
	urls: [
		'https://example.com/page1',
		'https://example.com/page2',
		'https://example.com/page3',
	],
	outputDir: './output',
	limit: 2, // 最大2つのURLを同時処理
});

// カスタムデバイス
await replicate({
	urls: ['https://example.com'],
	outputDir: './output',
	devices: {
		desktop: { width: 1400 },
		mobile: { width: 375, resolution: 2 },
	},
	timeout: 30000,
	verbose: true,
});

// HTMLページのみダウンロード
await replicate({
	urls: ['https://example.com'],
	outputDir: './output',
	only: 'page',
});

// リソースのみダウンロード
await replicate({
	urls: ['https://example.com'],
	outputDir: './output',
	only: 'resource',
});

機能

  • 並列処理: 複数のURLを並列で効率的に処理
  • メモリ効率: リソースを直接ディスクに保存してメモリ使用量を最小化
  • 選択的ダウンロード: --onlyオプションでHTMLページのみまたはリソースのみをダウンロード可能
  • レスポンシブ画像対応: 複数のデバイス幅で<picture>要素やメディアクエリのリソースを取得
  • 遅延読み込み対応: ページを自動スクロールしてloading=lazyIntersectionObserverベースのコンテンツを取得
  • マルチデバイスシミュレーション: 様々なデバイス幅と解像度をシミュレートして包括的なリソース取得を実現
  • HTMLページのディレクトリ構造を保持してダウンロード
  • 関連するすべてのリソース(CSS、JS、画像など)を取得
  • リソース間の相対リンクを維持
  • 同一ホストのリソースのみサポート(複数ホストが検出された場合はエラー)
  • 元のファイル拡張子とパスを保持

License

MIT