• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Class: SerializerStream
2
3Streaming AST node to an HTML serializer. A [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable).
4
5*__example__*:
6
7```js
8const parse5 = require('parse5');
9const SerializerStream = require('parse5-serializer-stream');
10const fs = require('fs');
11
12const file = fs.createWriteStream('/home/index.html');
13
14// Serializes the parsed document to HTML and writes it to the file.
15const document = parse5.parse('<body>Who is John Galt?</body>');
16const serializer = new SerializerStream(document);
17
18serializer.pipe(file);
19```
20
21### Constructors
22
23* [constructor](#constructor)
24
25### Methods and events
26
27See: [readable stream API](https://nodejs.org/api/stream.html#stream_class_stream_readable).
28
29---
30
31## Constructors
32
33<a id="constructor"></a>
34
35###  constructor
36
37⊕ **new SerializerStream**(node: *Node*, options?: *[SerializerOptions](../../parse5/docs/options/serializer-options.md)*): [SerializerStream]()
38
39Streaming AST node to an HTML serializer. A readable stream.
40
41**Parameters:**
42
43| Param | Type | Description |
44| ------ | ------ | ------ |
45| node | Node |  Node to serialize. |
46| `Optional` options | [SerializerOptions](../../parse5/docs/options/serializer-options.md) |  Serialization options. |
47
48**Returns:** [SerializerStream]()
49
50___
51