{"id":13618429,"url":"https://github.com/wabarc/cairn","last_synced_at":"2025-04-11T03:51:00.492Z","repository":{"id":37800842,"uuid":"302261532","full_name":"wabarc/cairn","owner":"wabarc","description":"NPM package and CLI tool for saving web page as single HTML file","archived":false,"fork":false,"pushed_at":"2024-05-28T23:18:42.000Z","size":549,"stargazers_count":37,"open_issues_count":26,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-29T13:55:11.439Z","etag":null,"topics":["archive","base64","cli","html","html-files","internet-archive","javascript","memento","mhtml","node","nodejs","npm-package","obelisk","single-file","typescript","wayback","wayback-archiver","webpage"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wabarc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-08T07:18:16.000Z","updated_at":"2024-06-07T15:52:46.701Z","dependencies_parsed_at":"2024-01-09T18:04:45.476Z","dependency_job_id":"e2091a99-d8ba-4036-bd89-c58cf2cb044f","html_url":"https://github.com/wabarc/cairn","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":"wabarc/project-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wabarc%2Fcairn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wabarc%2Fcairn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wabarc%2Fcairn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wabarc%2Fcairn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wabarc","download_url":"https://codeload.github.com/wabarc/cairn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339262,"owners_count":21087214,"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":["archive","base64","cli","html","html-files","internet-archive","javascript","memento","mhtml","node","nodejs","npm-package","obelisk","single-file","typescript","wayback","wayback-archiver","webpage"],"created_at":"2024-08-01T20:02:01.354Z","updated_at":"2025-04-11T03:51:00.463Z","avatar_url":"https://github.com/wabarc.png","language":"TypeScript","funding_links":[],"categories":["Tools \u0026 Software","cli","TypeScript"],"sub_categories":["Acquisition"],"readme":"# Cairn\n\n```text\n\n    //   ) )                              \n   //         ___     ( )  __       __    \n  //        //   ) ) / / //  ) ) //   ) ) \n //        //   / / / / //      //   / /  \n((____/ / ((___( ( / / //      //   / /   \n\n```\n\nCairn is an npm package and CLI tool for saving the web page as a single HTML file,\nit is TypeScript implementation of [Obelisk](https://github.com/go-shiori/obelisk).\n\n## Features\n\n## Usage\n\n### As CLI tool\n\n```sh\nnpm install -g @wabarc/cairn\n```\n\n```sh\n$ cairn -h\n\nUsage: cairn [options] url1 [url2]...[urlN]\n\nCLI tool for saving web page as single HTML file\n\nOptions:\n  -v, --version                         output the current version\n  -o, --output \u003cstring\u003e                 path to save archival result\n  -u, --user-agent \u003cstring\u003e             set custom user agent\n  -p, --proxy [protocol://]host[:port]  use this proxy\n  -t, --timeout \u003cnumber\u003e                maximum time (in second) request timeout\n  --no-js                               disable JavaScript\n  --no-css                              disable CSS styling\n  --no-embeds                           remove embedded elements (e.g iframe)\n  --no-medias                           remove media elements (e.g img, audio)\n  -h, --help                            display help for command\n```\n\n### As npm package\n\n```sh\nnpm install @wabarc/cairn\n```\n\n```javascript\nimport { Cairn } from '@wabarc/cairn';\n// const cairn = require('@wabarc/cairn');\n\nconst cairn = new Cairn();\n\ncairn\n  .request({ url: url })\n  .options({ userAgent: 'Cairn/2.0.0', proxy: 'socks5://127.0.0.1:1080' })\n  .archive()\n  .then((archived) =\u003e {\n    console.log(archived.url, archived.webpage.html());\n  })\n  .catch((err) =\u003e console.warn(`${url} =\u003e ${JSON.stringify(err)}`));\n```\n\n#### Instance methods\n\n##### cairn#request({ url: string }): this\n##### cairn#options({}): this\n- proxy?: string;\n- userAgent?: string;\n- disableJS?: boolean;\n- disableCSS?: boolean;\n- disableEmbeds?: boolean;\n- disableMedias?: boolean;\n- timeout?: number;\n\n##### cairn#archive(): Promise\u003cArchived\u003e\n##### cairn#Archived\n- url: string;\n- webpage: cheerio.Root;\n- status: 200 | 400 | 401 | 403 | 404 | 500 | 502 | 503 | 504;\n- contentType: 'text/html' | 'text/plain' | 'text/*';\n\n#### Request Params\n\n##### request\n\n```javascript\n{\n  // `url` is archival target.\n  url: 'https://www.github.com'\n}\n```\n\n##### options\n\n```javascript\n{\n  proxy: 'socks5://127.0.0.1:1080',\n  userAgent: 'Cairn/2.0.0',\n\n  disableJS: true,\n  disableCSS: false,\n  disableEmbeds: false,\n  disableMedias: true,\n\n  timeout: 30\n}\n```\n\n#### Response Schema\n\nfor v1.x:\n\nThe `archive` method will return webpage body as string.\n\nfor v2.x:\n\n```javascript\n{\n  url: 'https://github.com/',\n  webpage: cheerio.Root,\n  status: 200,\n  contentType: 'text/html'\n}\n```\n\n## License\n\nCairn has been re-licensed under MIT since version 3.0.0. If you are using versions 2 and 1, you should note that it is licensed under GPL 3.0.\n\nThis software is released under the terms of the MIT. See the [LICENSE](https://github.com/wabarc/cairn/blob/main/LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwabarc%2Fcairn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwabarc%2Fcairn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwabarc%2Fcairn/lists"}