Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/pad-stream
Pad each line in a stream
https://github.com/sindresorhus/pad-stream
Last synced: 4 months ago
JSON representation
Pad each line in a stream
- Host: GitHub
- URL: https://github.com/sindresorhus/pad-stream
- Owner: sindresorhus
- License: mit
- Created: 2015-01-25T10:03:30.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2023-08-31T15:49:03.000Z (over 1 year ago)
- Last Synced: 2024-04-14T06:11:04.134Z (10 months ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 11
- Watchers: 6
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
- Security: .github/security.md
Awesome Lists containing this project
- awesome-nodejs-cn - pad-stream - 填充流中的每一行 (包 / 文件流)
- awesome-nodejs-cn - pad-stream - **star:11** 将每一行填充到一个流中 (包 / 流)
- awesome-nodejs - pad-stream - Pad each line in a stream. (Packages / Streams)
- awesome-nodejs - pad-stream - Pad each line in a stream - ★ 5 (Streams)
- awesome-node - pad-stream - Pad each line in a stream. (Packages / Streams)
- awesome-nodejs-cn - pad-stream - 填充流中的每一行. (目录 / 流处理)
README
# pad-stream
> Pad each line in a stream
## Install
```sh
npm install pad-stream
```## Usage
```js
// pad.js
import padStream from 'pad-stream';process.stdin.pipe(padStream(2, '>')).pipe(process.stdout);
``````
$ echo 'foo\nbar' | node pad.js
>>foo
>>bar
```## API
### padStream(count, indent?)
Returns a [transform stream](https://nodejs.org/api/stream.html#stream_duplex_and_transform_streams).
#### count
Type: `number` *(integer)*
The number of times to repeat `indent`.
#### indent
Type: `string`\
Default: `' '`The string to use as indent.
## Related
- [indent-string](https://github.com/sindresorhus/indent-string) - Indent each line in a string
- [indent-string-cli](https://github.com/sindresorhus/indent-string-cli) - Indent each line in some text or stdin