Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow zero backups #59

Closed
gabrielbrieva opened this issue Feb 25, 2020 · 3 comments · Fixed by #74
Closed

Allow zero backups #59

gabrielbrieva opened this issue Feb 25, 2020 · 3 comments · Fixed by #74
Milestone

Comments

@gabrielbrieva
Copy link

It is possible to allow zero backups files?

@lamweili
Copy link
Contributor

lamweili commented Jan 9, 2022

I tried the following and it didn't work.

var rollers = require('streamroller');
var stream = new rollers.RollingFileStream('myfile', 3, 0);
stream.write("abc");
stream.write("def");
stream.write("ghi");
stream.end();

Output:

myfile   - ghi
myfile.1 - def

@lamweili
Copy link
Contributor

lamweili commented Jan 12, 2022

I tried the following and it now works.

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

@lamweili
Copy link
Contributor

For details, refer to #74 (comment)

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 a pull request may close this issue.

2 participants