{"id":18396651,"url":"https://github.com/rob--/archivejs","last_synced_at":"2025-04-12T15:05:52.293Z","repository":{"id":57183339,"uuid":"95607880","full_name":"Rob--/archivejs","owner":"Rob--","description":"Node module to archive entire websites.","archived":false,"fork":false,"pushed_at":"2017-06-27T23:52:35.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T15:05:15.902Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rob--.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-27T23:01:49.000Z","updated_at":"2024-02-29T23:57:02.000Z","dependencies_parsed_at":"2022-09-14T06:11:14.855Z","dependency_job_id":null,"html_url":"https://github.com/Rob--/archivejs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rob--%2Farchivejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rob--%2Farchivejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rob--%2Farchivejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rob--%2Farchivejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rob--","download_url":"https://codeload.github.com/Rob--/archivejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586235,"owners_count":21128997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T02:14:29.696Z","updated_at":"2025-04-12T15:05:52.268Z","avatar_url":"https://github.com/Rob--.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## archivejs\n\nA Node module to archive websites. The module attempts to scan websites\nand download as many pages as it can find.\n\n```javascript\nconst Archive = require('archivejs');\nconst site = new Archive('http://example.com', {\n  threads: 2\n});\n\nsite.start();\n```\n\n## Installation\n```javascript\n$ npm install archivejs\n```\n\n## Example:\n\nThis module works by downloading as much of a website as possible. If a\nwebsite existed with the following urls:\n\n`http://example.com`\n\n`http://example.com/image.png`\n\n`http://example.com/docs`\n\n`http://example.com/docs/user.json`\n\nThe website would be saved with the following folder structure:\n\n- `example.com`\n  - `image.png.archive`\n  - `docs`\n    - `user.json`\n\n`archives\\example.com\\`\n\n`archives\\example.com\\image.png.archive`\n\n`archives\\example.com\\docs\\.archive`\n\n`archives\\example.com\\docs\\user.json.archive`\n\n---\n\nFor example, if `reddit.com` was archived, the page requested when\nvisiting `reddit.com` would be saved in the folder `reddit.com` with the\nfile name `.archive` (or `index.archive`).\n\nThe main limitation is that only pages that are linked can be archived.\nAny pages hidden or not referenced to from the main page or subsequent\nscraped pages are not downloaded.\n\n## Usage\n\nInstantiate the archive class as per the example above (`new Archive(url, options)`).\n\nTo start archiving:\n`site.start();`\n\nTo stop archiving: `site.stop();`\n\nTo attach event listeners: `site.on(eventName, callback);`\n\nFor a full example, refer to `example.js`.\n\nYou can pass options when creating an archive by passing an object\nafter the URL:\n- `threads` - the number of workers to scrape the site in parallel,\ndefaults to `1`\n- `path` - the root path of the directory to save the archives, defaults\nto `__dirname`\n- `requestDelay` - the time in milliseconds to wait before making another\nrequest after scraping a page, defaults to `50`\n\n## Features\n- downloads pages to a given folder\n- scrapes pages for resources such as .css or .js files\n- downloads images and svg files from pages (from image elements)\n- find links between pages to repeat the download/scrape process\n\nTODO:\n- video downloads\n- proxy support to prevent rate limiting\n\n## Events\n\nEvent listeners can be attached to the archive to monitor progress and\nget statistics.\n\n---\n\n### scrape\n\n- `url` the url being requested/scraped\n\nEmitted just before a page is scraped.\n\n---\n\n### link\n\n- `url` - new url that was found when scraping, and will be added to\nthe queue to be scraped\n\nEmitted when parsing a page and a link is found.\n\n---\n\n### saved\n\n- `data` - object containing data about the page saved\n  - `fileName` - name of the file saved\n  - `path` - path relative to the archive project root\n  - `fullPath` - full path of the file on disk\n  - `size` - size of the file in bytes\n  - `stats` - object providing stats about the entire archive progress\n    - `size` - total size in bytes downloaded and saved to disk\n    - `saved` - number of pages saved so far\n\nEmitted every time a page is downloaded and saved to disk.\n\n---\n\n### error\n\n- `message` - message providing context\n- `error` - the errow that was thrown\n\nEmitted every time an error occurs. An event listener needs to be\nset up for this event to prevent errors from being thrown.\n\n---\n\n### debug\n\n- `message` - debug info","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frob--%2Farchivejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frob--%2Farchivejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frob--%2Farchivejs/lists"}