{"id":18940327,"url":"https://github.com/donejs/vdom-streaming-serializer","last_synced_at":"2025-10-26T21:07:28.993Z","repository":{"id":136944190,"uuid":"82805686","full_name":"donejs/vdom-streaming-serializer","owner":"donejs","description":"A streaming serializing for virtual DOMs that look like a real DOM","archived":false,"fork":false,"pushed_at":"2020-05-23T12:15:40.000Z","size":55,"stargazers_count":1,"open_issues_count":10,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-25T09:41:27.305Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/donejs.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-02-22T13:10:33.000Z","updated_at":"2018-12-28T00:22:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"2836d70e-b0e8-491c-8e04-c1f864e427a9","html_url":"https://github.com/donejs/vdom-streaming-serializer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/donejs/vdom-streaming-serializer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donejs%2Fvdom-streaming-serializer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donejs%2Fvdom-streaming-serializer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donejs%2Fvdom-streaming-serializer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donejs%2Fvdom-streaming-serializer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donejs","download_url":"https://codeload.github.com/donejs/vdom-streaming-serializer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donejs%2Fvdom-streaming-serializer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259910633,"owners_count":22930699,"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-08T12:21:59.151Z","updated_at":"2025-10-26T21:07:23.974Z","avatar_url":"https://github.com/donejs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/donejs/vdom-streaming-serializer.png?branch=master)](https://travis-ci.org/donejs/vdom-streaming-serializer)\n[![npm version](https://badge.fury.io/js/vdom-streaming-serializer.svg)](https://badge.fury.io/js/vdom-streaming-serializer)\n\n# vdom-streaming-serializer\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/donejs/vdom-streaming-serializer.svg)](https://greenkeeper.io/)\n\nThe vdom-streaming-serializer is a library for serializing virtual DOM objects into chunks of strings that can be written into an HTTP response.\n\n## Installation\n\n```\nnpm install vdom-streaming-serializer\n```\n\n## Usage\n\nA virtual dom has to be created and running the serialization will emit chunks of HTML.\n\n### Example\n\nThis example creates a virtual dom and serializes it to emit streams of HTML elements in Chunks.\n\n```js\nvar document = makeDocument();\nvar ul = document.createElement('ul');\ndocument.body.appendChild(ul);\nvar li = document.createElement('li');\n```\n\nMaking this `\u003cli\u003e` as asynchronous will force the serialize to wait.\n\n```js\nvar ASYNC = Symbol.for('async-node');\nli[ASYNC] = Promise.resolve();\nul.appendChild(li);\n```\n\nOnce the element is serialized, it is then emitted in `data` event.\n\n```js\nvar stream = serialize(document);\nstream.setEncoding('utf8');\nstream.on('data', function(html){\n\tconsole.log('Chunk', html);\n});\n```\n\nThe output from this demo should be:\n\n```\nChunk \u003chtml\u003e\u003cbody\u003e\u003cul\u003e\nChunk \u003cli\u003e\u003c/li\u003e\u003c/ul\u003cbody\u003e\u003c/html\u003e\n```\n\nFrom this, the `\u003cli\u003e` element is serialized asynchronously.\n\n\n## API\n\nThe serialization process traverses and checks for html syntax and attributes to add to the buffer.\n\nUpon noticing a child node, the serializer determines whether its child is asynchronous or not. If it is, the current buffer is flushed and the element begins serializing the asynchronous child.\n\n### Asynchronization\n\nIt handles synchronous and asynchronous elements differently by resolving promise elements if we wish to wait before emitting.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonejs%2Fvdom-streaming-serializer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonejs%2Fvdom-streaming-serializer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonejs%2Fvdom-streaming-serializer/lists"}