Skip to content

Commit cc7d74c

Browse files
committed
adding cautionary notes about .on('data')
1 parent 3008eff commit cc7d74c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ See `addFile()` for the meaning of `mtime` and `mode`.
100100
If `size` is given, it will be checked against the actual number of bytes in the `readStream`,
101101
and an error will be emitted if there is a mismatch.
102102

103+
Note that yazl will `.pipe()` data from `readStream`, so be careful using `.on('data')`.
104+
In certain versions of node, `.on('data')` makes `.pipe()` behave incorrectly.
105+
103106
#### addBuffer(buffer, metadataPath, [options])
104107

105108
Adds a file to the zip file whose content is `buffer`.
@@ -169,6 +172,9 @@ Data becomes available in this stream soon after calling one of `addFile()`, `ad
169172
Clients can call `pipe()` on this stream at any time,
170173
such as immediately after getting a new `ZipFile` instance, or long after calling `end()`.
171174

175+
As a reminder, be careful using both `.on('data')` and `.pipe()` with this stream.
176+
In certain versions of node, you cannot use both `.on('data')` and `.pipe()` successfully.
177+
172178
### dateToDosDateTime(jsDate)
173179

174180
`jsDate` is a `Date` instance.

0 commit comments

Comments
 (0)