-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add EOL option. #1
Conversation
@catdad Thanks for the library. I will mention my use-case. I have an FTP server written for node, and I need to implement ASCII file transfer mode. In that mode, the server must convert from BTW, I reviewed all the libraries on npm that I could find for this task and they were all broken, overly complex, did not handle streams or did not handle the carryover from a previous chunk. I may have some additional PRs once I integrate this into my codebase, I am working with file and socket streams there. |
Thanks for submitting this PR! In the description you say that you "simplify implementation", but that doesn't really give me information about what you changed and why you changed it. Can you describe the simplifications you made and why they were made, please? |
The simplification I refer to is in two forms.
|
As far as why, I am always looking for ways to remove lines of code, as lines of code have bugs. less code = less bugs. Not only that, but allowing the caller to choose the replacement EOL char (my requirement) required the logic to be modified. Instead of adding a ton of new conditions, I just simplified the code so that existing EOL chars are all handled in a uniform way. |
I updated the build so that it once again is running. Please take a look at the current failures. Some are due to issues I already mentioned in the review. |
I thought I had pushed those fixes yesterday when I replied. Either I forgot or it failed for some reason. In any case, they are pushed now. |
Sorry for the delay, I got super distracted. I made some additional changes and fixed some additional issues, and this looks good now. Thanks for adding this feature! |
Unfortunately, I actually had to revert this. I found out after I merged it that it does have a bug in it and does not allow for the same functionality as the previous implementation. The bug is in this line: var endCrlf = /\r|\n$/; This regular expression checks for a The previous code included behavior when either is at the end. Looking at code coverage, you can see that the I didn't have time to investigate what the issue is. If you want, feel free to recreate this PR and fix the issue. I guess if nothing else, we both learned that less code can have more bugs 😉. |
I made a new PR. I don't think I learned anything of the sort. The solution was to REMOVE CODE ;-) |
'\r'
,'\n'
or'\r\n'
.