{"id":15779227,"url":"https://github.com/shun-shobon/littlexml","last_synced_at":"2025-08-19T03:09:51.290Z","repository":{"id":143147593,"uuid":"612510632","full_name":"shun-shobon/littlexml","owner":"shun-shobon","description":"1kB XML library for Node.js, Bun, Deno, Browser, Edge runtime.","archived":false,"fork":false,"pushed_at":"2025-08-17T21:23:18.000Z","size":1666,"stargazers_count":4,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-18T01:49:38.727Z","etag":null,"topics":["cloudflare-workers","deno","javascript","typescript","xml"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@shun-shobon/littlexml","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/shun-shobon.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,"zenodo":null},"funding":{"github":"shun-shobon"}},"created_at":"2023-03-11T06:43:31.000Z","updated_at":"2025-08-17T17:52:46.000Z","dependencies_parsed_at":"2023-12-21T15:47:12.030Z","dependency_job_id":"8834c8b2-6efd-44cd-abc9-d5fc3d927075","html_url":"https://github.com/shun-shobon/littlexml","commit_stats":{"total_commits":286,"total_committers":4,"mean_commits":71.5,"dds":"0.27622377622377625","last_synced_commit":"5b1e039636e1394dc1237864231cea89d158917d"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/shun-shobon/littlexml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shun-shobon%2Flittlexml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shun-shobon%2Flittlexml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shun-shobon%2Flittlexml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shun-shobon%2Flittlexml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shun-shobon","download_url":"https://codeload.github.com/shun-shobon/littlexml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shun-shobon%2Flittlexml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270932674,"owners_count":24670249,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cloudflare-workers","deno","javascript","typescript","xml"],"created_at":"2024-10-04T18:03:26.428Z","updated_at":"2025-08-19T03:09:51.247Z","avatar_url":"https://github.com/shun-shobon.png","language":"TypeScript","funding_links":["https://github.com/sponsors/shun-shobon"],"categories":[],"sub_categories":[],"readme":"# @shun-shobon/littlexml\n\n1kB XML library for Node.js, Bun, Deno, Browser, Edge runtime.\n\n[![npm](https://img.shields.io/npm/v/@shun-shobon/littlexml?logo=npm)](https://www.npmjs.com/package/@shun-shobon/littlexml)\n[![bundle size](https://img.shields.io/bundlephobia/minzip/@shun-shobon/littlexml)](https://bundlephobia.com/package/@shun-shobon/littlexml)\n[![test](https://github.com/shun-shobon/littlexml/actions/workflows/check.yml/badge.svg)](https://github.com/shun-shobon/littlexml/actions/workflows/check.yml)\n[![codecov](https://codecov.io/gh/shun-shobon/littlexml/branch/master/graph/badge.svg?token=VAZxHGjjpu)](https://codecov.io/gh/shun-shobon/littlexml)\n\n## About\n\nThis library is designed to run on small JavaScript runtimes such as Cloudflare\nWorkers. It also works on Node.js, Bun, Deno, and browsers.\n\n## Features\n\n- Render XML as a string, iterator, or stream.\n- Render XML with indentation.\n\n## Support platforms\n\n- Node.js\n- Deno\n- Bun\n- Browser\n- Edge runtime like Cloudflare Workers, Vercel Edge Functions\n\n## Installation\n\n### Node.js / Bun\n\nInstall package from npm. You can also use yarn/pnpm instead of npm.\nIf you are using Bun, you can install with `bun add` command.\n\n```sh\nnpm install @shun-shobon/littlexml\n```\n\nYou can import from the package as `@shun-shobon/littlexml`.\n\n```ts\nimport { element, renderToString } from \"@shun-shobon/littlexml\";\n```\n\n\u003c!-- x-release-please-start-version --\u003e\n\n### Deno\n\nYou can directly import from `npm:@shun-shobon/littlexml`.\n\n```ts\nimport { element, renderToString } from \"npm:littlexml@0.6.2\";\n```\n\n### Browser\n\nYou can directly import from `unpkg.com`.\n\n```js\nimport {\n\telement,\n\trenderToString,\n} from \"https://unpkg.com/@shun-shobon/littlexml@0.6.2\";\n```\n\n\u003c!-- x-release-please-end --\u003e\n\n## Example\n\nThis example is rendering a sitemap.\n\n```typescript\nimport { element, renderToString } from \"@shun-shobon/littlexml\";\n\nconst root = element(\"urlset\")\n\t.attr(\"xmlns\", \"http://www.sitemaps.org/schemas/sitemap/0.9\")\n\t.attr(\"xmlns:image\", \"http://www.google.com/schemas/sitemap-image/1.1\")\n\t.child(\n\t\telement(\"url\")\n\t\t\t.child(element(\"loc\").text(\"https://example.com/\"))\n\t\t\t.child(element(\"lastmod\").text(\"2020-01-01\"))\n\t\t\t.child(element(\"changefreq\").text(\"daily\"))\n\t\t\t.child(element(\"priority\").text(\"0.8\"))\n\t\t\t.child(\n\t\t\t\telement(\"image:image\")\n\t\t\t\t\t.child(element(\"image:loc\").text(\"https://example.com/image.png\"))\n\t\t\t\t\t.child(element(\"image:caption\").text(\"caption\")),\n\t\t\t),\n\t);\n\nconst xml = renderToString(root, { version: \"1.0\", indent: 2 });\n\nconsole.log(xml);\n```\n\nconsole output:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003curlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\"\u003e\n  \u003curl\u003e\n    \u003cloc\u003ehttps://example.com/\u003c/loc\u003e\n    \u003clastmod\u003e2020-01-01\u003c/lastmod\u003e\n    \u003cchangefreq\u003edaily\u003c/changefreq\u003e\n    \u003cpriority\u003e0.8\u003c/priority\u003e\n    \u003cimage:image\u003e\n      \u003cimage:loc\u003ehttps://example.com/image.png\u003c/image:loc\u003e\n      \u003cimage:caption\u003ecaption\u003c/image:caption\u003e\n    \u003c/image:image\u003e\n  \u003c/url\u003e\n\u003c/urlset\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshun-shobon%2Flittlexml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshun-shobon%2Flittlexml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshun-shobon%2Flittlexml/lists"}