Skip to content

Commit a110d8b

Browse files
committed
Implemented _final method
1 parent 564a02c commit a110d8b

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v0.3.0 2018-02-03
4+
5+
* Implemented `_final` method which calls `end` on file stream.
6+
37
## v0.2.0 2018-02-02
48

59
* Only public interface of Writable is used.

lib/file-timestamp-stream.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,21 @@ class FileTimestampStream extends Writable {
5555
}
5656
}
5757

58+
_final (callback) {
59+
if (this.stream) {
60+
this.stream.end(callback)
61+
} else {
62+
callback()
63+
}
64+
}
65+
5866
_destroy (err, callback) {
5967
if (this.stream) {
6068
this.stream.destroy()
6169
this.stream.removeListener('error', this._streamErrorHandler)
6270
this.stream = undefined
6371
}
64-
super._destroy(err, callback)
72+
callback(err)
6573
}
6674
}
6775

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "file-timestamp-stream",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Writing stream with file rotating based on timestamp",
55
"main": "lib/file-timestamp-stream.js",
66
"typings": "lib/file-timestamp-stream.d.ts",

0 commit comments

Comments
 (0)