{"id":16231516,"url":"https://github.com/hustcc/uri-parse","last_synced_at":"2025-10-19T02:32:04.372Z","repository":{"id":57387479,"uuid":"110636722","full_name":"hustcc/uri-parse","owner":"hustcc","description":":link: Mini data-uri parser for nodejs and browser. No dependencies!","archived":false,"fork":false,"pushed_at":"2020-06-13T07:44:47.000Z","size":11,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-28T19:12:04.262Z","etag":null,"topics":["data-uri","uri","uri-parse","uri-parser","url-parser"],"latest_commit_sha":null,"homepage":"https://git.hust.cc/uri-parse","language":"JavaScript","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/hustcc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-14T03:40:43.000Z","updated_at":"2023-09-08T17:32:34.000Z","dependencies_parsed_at":"2022-09-07T14:51:14.713Z","dependency_job_id":null,"html_url":"https://github.com/hustcc/uri-parse","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/hustcc%2Furi-parse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Furi-parse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Furi-parse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Furi-parse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hustcc","download_url":"https://codeload.github.com/hustcc/uri-parse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243997041,"owners_count":20380980,"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":["data-uri","uri","uri-parse","uri-parser","url-parser"],"created_at":"2024-10-10T13:05:55.082Z","updated_at":"2025-10-19T02:31:59.333Z","avatar_url":"https://github.com/hustcc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# uri-parse\n\n\u003e Mini data-uri parser for nodejs and browser. No dependencies! 一个简单的无依赖 uri 解析库。\n\n[![Ver](https://img.shields.io/npm/v/uri-parse.svg)](https://www.npmjs.com/package/uri-parse) [![Build Status](https://travis-ci.org/hustcc/uri-parse.svg?branch=master)](https://travis-ci.org/hustcc/uri-parse) [![Coverage Status](https://coveralls.io/repos/github/hustcc/uri-parse/badge.svg?branch=master)](https://coveralls.io/github/hustcc/uri-parse) [![npm download](https://img.shields.io/npm/dm/uri-parse.svg)](https://www.npmjs.com/package/uri-parse)\n\n\n```\n/*\n * parse url like this\n *\n * schema://username:password@host:port/path?key=value#fragment;key=value\n * \\____/   \\______/ \\______/ \\__/ \\__/ \\__/ \\_______/ \\______/ \\______/\n *   |         |        |       |    |    |      |         |       |\n * schema      |     password   |   port  |    query    fragment   |\n *          username          host      path                     extension\n *\n * note:\n *   - username, password, port, path, query, fragment, extension is optional.\n *   - scheme, host must be setting.\n *   - username and password must be paired.\n */\n```\n\n\n## 1. Install\n\n\u003e **npm i --save uri-parse**\n\nThen import it.\n\n```js\nimport URI from 'uri-parse'; // ES6\nvar URI = require('uri-parse'); // ES5 with npm\n```\n\n\n## 2. Usage\n\n - `uri.all()`: parse uri information.\n\n```js\nimport URI from 'uri-parse';\n\nconst u = 'scheme://username:password@host:port/path?name=hustcc#fragment;ext=hello';\n\nconst uri = new URI(u);\n\nconst { schema, username, password, host, port, path, query, fragment, extension } = uri.all();\n\n/*\n{\n  schema: 'scheme',\n  username: 'username',\n  password: 'password',\n  host: 'host',\n  port: 'port',\n  path: 'path',\n  query: {\n    name: 'hustcc'\n  },\n  fragment: 'fragment',\n  extension: {\n    ext: 'hello'\n  }\n}\n*/\n\n// or get the properties of the instance.\nconst schema = url.schema;\n```\n\n - `uri.toURI()`: modify and generate uri string.\n\n\n```js\nimport URI from 'uri-parse';\n\nconst u = 'https://atool.vip/path?name=hustcc#fragment;ext=hello';\n\nconst uri = new URI(u);\n\n// also you can update the uri.\nuri.query = {\n  ...uri.query,\n  p: 'testQuery', // add a query parameter.\n};\n\n// get the new url\nconst uriString = uri.toURI();\n// got 'https://atool.vip/path?name=hustcc\u0026p=testQuery#fragment;ext=hello';\n```\n\n\n## 3. Test \u0026 Perf\n\n```\nnpm i\n\nnpm run test\n```\n\n\n## License\n\nMIT@[hustcc](https://github.com/hustcc).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhustcc%2Furi-parse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhustcc%2Furi-parse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhustcc%2Furi-parse/lists"}