Skip to content

allow for zero backup - https://github.com/log4js-node/streamroller/pull/74#1151

Merged
lamweili merged 1 commit intomasterfrom
feat-zero-backup
Jan 19, 2022
Merged

allow for zero backup - https://github.com/log4js-node/streamroller/pull/74#1151
lamweili merged 1 commit intomasterfrom
feat-zero-backup

Conversation

@lamweili
Copy link
Copy Markdown
Contributor

@lamweili lamweili commented Jan 19, 2022

Related to log4js-node/streamroller#59, log4js-node/streamroller#74 and PR #1135

Important
It is also to note the file does not roll within itself (truncate its older entry for newer entry).
It truncates all and appends only the new entry.

var rollers = require('streamroller');
var stream = new rollers.RollingFileStream('myfile', 6, 0);
stream.write("abc"); // add as first row
stream.write("def"); // add as second row
stream.write("ghi"); // truncate all and add as first row
stream.end();

Output:

myfile   - ghi

**Important**
It is also to note the file does not roll within itself (truncate its older entry for newer entry).
It truncates all and appends only the new entry.

```javascript
var rollers = require('streamroller');
var stream = new rollers.RollingFileStream('myfile', 6, 0);
stream.write("abc"); // add as first row
stream.write("def"); // add as second row
stream.write("ghi"); // truncate all and add as first row
stream.end();
```

Output:
```
myfile   - ghi
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant