donejs / donejs/vdom-streaming-serializer
API
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
The API for **vdom-streaming-serializer** is:
## signature
`serialize(element) -> stream`
In context of a web server it will look like:
```js
var http = require('http');
var makeDocument = require('can-vdom/make-document/make-document');
var serialize = require('vdom-streaming-serializer');
http.createServer(function(request, response){
var document = makeDocument();
var h1 = document.createElement('h1');
h1.appendChild(document.createTextNode('Hello world!'));
document.body.appendChild(h1);
var stream = serialize(document.documentElement);
stream.pipe(response);
});
```
### Parameters
* `element` is any DOM [Node](https://developer.mozilla.org/en-US/docs/Web/API/Node). In practice this will be a [documentElement](https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement) created with [can-simple-dom](https://github.com/canjs/can-simple-dom).
```js
var makeDocument = require('can-vdom/make-document/make-document');
var serialize = require('vdom-streaming-serializer');
var document = makeDocument();
serialize(document.documentElement);
```
### Returns
* A [Node.js ReadableStream](https://nodejs.org/api/stream.html#stream_readable_streams) object. This stream can then be [piped](https://nodejs.org/api/stream.html#stream_readable_pipe_destination_options) into an HTTP response object:
```js
var stream = serialize(document.documentElement);
stream.pipe(response);
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the package documentation and the serialize(element) entry point described here, then compare the documented signature, DOM input, and Node.js ReadableStream return value with the current package behavior. Done means the API usage, parameters, return value, and HTTP piping example are accurate and complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100