daily-rotating-file-stream
Advanced tools
Comparing version
@@ -40,2 +40,6 @@ 'use strict' | ||
flush () { | ||
this[stream].flush() | ||
} | ||
destroy () { | ||
@@ -42,0 +46,0 @@ this[stream].destroy() |
{ | ||
"name": "daily-rotating-file-stream", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "file stream being rotating daily", | ||
@@ -5,0 +5,0 @@ "main": "lib/DailyRotatingFileStream.js", |
@@ -5,3 +5,3 @@ # daily-rotating-file-stream | ||
[](https://coveralls.io/github/SerayaEryn/daily-rotating-file-stream?branch=master) | ||
[](https://www.npmjs.com/package/daily-rotating-file-stream) [](https://greenkeeper.io/) | ||
[](https://www.npmjs.com/package/daily-rotating-file-stream) | ||
[](https://standardjs.com) | ||
@@ -36,2 +36,6 @@ | ||
## DailyRotatingFileStream#flush() | ||
Flushes the content of the buffer to the file. | ||
## DailyRotatingFileStream#destroy() | ||
@@ -38,0 +42,0 @@ |
@@ -139,2 +139,22 @@ 'use strict' | ||
test('Should flush', (t) => { | ||
t.plan(2) | ||
const options = { | ||
fileName: join(__dirname, '/testfiles5/console%DATE%.log') | ||
} | ||
const fileName = getFileName(5) | ||
const stream = new DailyRotatingFileStream(options) | ||
stream.write('hello world') | ||
stream.flush() | ||
stream.on('finish', () => { | ||
fs.readFile(fileName, (err, buffer) => { | ||
t.error(err) | ||
t.strictEquals(buffer.toString(), 'hello world') | ||
cleanUp(fileName) | ||
}) | ||
}) | ||
stream.end() | ||
}) | ||
function cleanUp (fileName) { | ||
@@ -141,0 +161,0 @@ if (fs.existsSync(fileName)) { |
10074
4.95%220
10.55%50
8.7%