Skip to content

Commit c6fe834

Browse files
committed
clarify warning about finalSizeCallback. close #33
1 parent e38aac7 commit c6fe834

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ See `addFile()` for the meaning of `mtime` and `mode`.
182182
#### end([options], [finalSizeCallback])
183183

184184
Indicates that no more files will be added via `addFile()`, `addReadStream()`, or `addBuffer()`.
185-
Some time after calling this function, `outputStream` will be ended. Note that this entails that you cannot rely on this
186-
callback to know when you are done producing output. If for instance you are creating a zip archive on disk, you will need
187-
to listen to the `end` event on the `outputStream` before notifying consumers of that file.
188185

189186
`options` may be omitted or null and has the following structure and default values:
190187

@@ -204,6 +201,9 @@ sometime during or after the call to `end()`.
204201
`finalSize` is of type `Number` and can either be `-1`
205202
or the guaranteed eventual size in bytes of the output data that can be read from `outputStream`.
206203

204+
Note that `finalSizeCallback` is usually called well before `outputStream` has piped all its data;
205+
this callback does not mean that the stream is done.
206+
207207
If `finalSize` is `-1`, it means means the final size is too hard to guess before processing the input file data.
208208
This will happen if and only if the `compress` option is `true` on any call to `addFile()`, `addReadStream()`, or `addBuffer()`,
209209
or if `addReadStream()` is called and the optional `size` option is not given.

0 commit comments

Comments
 (0)