{"id":13567790,"url":"https://github.com/Last-Order/shua","last_synced_at":"2025-04-04T02:33:01.159Z","repository":{"id":37851139,"uuid":"226122498","full_name":"Last-Order/shua","owner":"Last-Order","description":"A lovely downloader","archived":false,"fork":false,"pushed_at":"2024-01-10T01:43:02.000Z","size":153,"stargazers_count":20,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T05:01:42.890Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/Last-Order.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-05T14:37:13.000Z","updated_at":"2025-02-05T15:53:36.000Z","dependencies_parsed_at":"2024-08-01T13:25:25.338Z","dependency_job_id":"3240b8fa-4f5b-46f6-a5dc-9620d4d6225c","html_url":"https://github.com/Last-Order/shua","commit_stats":{"total_commits":73,"total_committers":2,"mean_commits":36.5,"dds":0.0273972602739726,"last_synced_commit":"0e805476c3f0037838df7345ad49a225379fe15d"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Last-Order%2Fshua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Last-Order%2Fshua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Last-Order%2Fshua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Last-Order%2Fshua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Last-Order","download_url":"https://codeload.github.com/Last-Order/shua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247092377,"owners_count":20882218,"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-08-01T13:02:43.298Z","updated_at":"2025-04-04T02:33:00.854Z","avatar_url":"https://github.com/Last-Order.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Shua\n\nShua is a common file downloader implemented by Node.js. Inspired by Minyami download core.\n\nThe target of Shua is to provide a way to download thousands of small files in a short time.\n\n## Installation\n\n```\nnpm install -g shua\n```\n\nNote: Shua needs Node.js 12.0.0+.\n\n## Expressions\n\nShua supports generating urls from a url expression.\n\n### Integer Expressions\n\nSyntax: `{{%d(start: integer, end: integer, step?: integer, leftPad?: integer)}}`\n\nFor example, to download\n\n```\nhttps://example.com/segment1.ts\nhttps://example.com/segment2.ts\nhttps://example.com/segment3.ts\n...\nhttps://example.com/segment100.ts\n```\n\nJust use the following command\n\n`shua -e \"https://example.com/segment{{%d(1, 100)}}.ts\"`\n\nMulti expressions is also supported.\n\nTo download\n\n```\nhttps://example.com/segment1_1.ts\nhttps://example.com/segment1_2.ts\n...\nhttps://example.com/segment1_10.ts\nhttps://example.com/segment2_1.ts\nhttps://example.com/segment2_2.ts\n...\nhttps://example.com/segment2_10.ts\n...\nhttps://example.com/segment5_10.ts\n```\n\nUse the following expression\n\n`shua -e \"https://example.com/segment{{%d(1, 5)}}_{{%d(1, 10)}}.ts\"`\n\nTo download\n\n```\nhttps://example.com/segment001.ts\nhttps://example.com/segment002.ts\nhttps://example.com/segment003.ts\n...\nhttps://example.com/segment100.ts\n```\n\nUse\n\n`shua -e \"https://example.com/segment{{%d(1, 100, 1, 3)}}.ts\"`\n\n## Example\n\n### Download all urls from a.txt with 16 threads\n\n```\nshua -f a.txt --threads 16\n```\n\n## Options\n\n### `--file, -f \u003cpath\u003e`\n\nDownload all URLs containing in a file. Both local path and remote URLs are supported as import. Lines couldn't be parsed as an valid URL will be ignored by default.\n\n#### Examples\n\n```bash\nshua -f \"files.txt\"\nshua -f \"https://example.com/file_list.txt\"\n```\n\n### `--expression, -e \u003cexpression\u003e`\n\nDownload all URLs generated from a expression. See `Expressions` section above.\n\n### `--json, -j \u003cpath\u003e`\n\nDownload tasks defined in a json file. JSON files should contain a `DownloadTask` array.\n\n```TypeScript\ninterface DownloadTask {\n    /** URL */\n    url: string;\n    /** retry count */\n    retryCount: number;\n    /** output filename */\n    filename?: string;\n    /** custom HTTP headers */\n    headers?: Record\u003cstring, string\u003e;\n}\ntype Tasks = DownloadTask[];\n```\n\n### `--threads \u003climit\u003e`\n\nThreads limit.\n\n### `--retries, -r \u003climit\u003e`\n\nMax attempts for download tasks.\n\n### `--timeout \u003cthreshold\u003e`\n\nTimeout threshold for download tasks in milliseconds.\n\n### `--concat, -c` (3.0.0+)\n\nConcatenate all downloaded files into a single output file.\n\n### `--output, -o \u003cname\u003e`\n\nOutput folder name.\n\nNested paths are not supported now.\n\nif `--concat` is provided, `--output` will be used for concentration.\n\n### `--ascending, -a`\n\nRename output files in numerical ascending order.\n\n### `--debug, --verbose`\n\nEnable debug log output.\n\n## Use as a library\n\n### Getting Started\n\n```JavaScript\nimport { Downloader } from 'shua';\nconst downloader = new Downloader();\ndownloader.addUrlsFromFile('urls.txt');\ndownloader.on('finish', () =\u003e {\n   console.log('All files downloaded!');\n});\ndownloader.start();\n\n```\n\n### Events\n\n| Event Name    | Parameters                                  |\n| ------------- | ------------------------------------------- |\n| `progress`    | `finishedCount: number, totalCount: number` |\n| `task-finish` | `task: Task`                                |\n| `task-error`  | `err: Error, task: Task`                    |\n| `finish`      |                                             |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLast-Order%2Fshua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLast-Order%2Fshua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLast-Order%2Fshua/lists"}