strip-final-newline
Advanced tools
Strip the final newline character from a string/buffer
Weekly downloads
Changelog
https://github.com/sindresorhus/strip-final-newline/compare/v2.0.0...v3.0.0
Readme
Strip the final newline character from a string/buffer
Can be useful when parsing the output of, for example, ChildProcess#execFile
, as binaries usually output a newline at the end. Normally, you would use stdout.trim()
, but that would also remove newlines at the start and whitespace.
$ npm install strip-final-newline
import stripFinalNewline from 'strip-final-newline';
stripFinalNewline('foo\nbar\n\n');
//=> 'foo\nbar\n'
stripFinalNewline(Buffer.from('foo\nbar\n\n')).toString();
//=> 'foo\nbar\n'
Strip the final newline character from a string/buffer
The npm package strip-final-newline receives a total of 18,315,579 weekly downloads. As such, strip-final-newline popularity was classified as popular.
We found that strip-final-newline demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.