新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
31 lines
923 B
Markdown
31 lines
923 B
Markdown
# strip-final-newline [](https://travis-ci.com/sindresorhus/strip-final-newline)
|
|
|
|
> Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) 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](https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline). Normally, you would use `stdout.trim()`, but that would also remove newlines at the start and whitespace.
|
|
|
|
|
|
## Install
|
|
|
|
```
|
|
$ npm install strip-final-newline
|
|
```
|
|
|
|
|
|
## Usage
|
|
|
|
```js
|
|
const stripFinalNewline = require('strip-final-newline');
|
|
|
|
stripFinalNewline('foo\nbar\n\n');
|
|
//=> 'foo\nbar\n'
|
|
|
|
stripFinalNewline(Buffer.from('foo\nbar\n\n')).toString();
|
|
//=> 'foo\nbar\n'
|
|
```
|
|
|
|
|
|
## License
|
|
|
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|