Skip to content

Commit 42a2b85

Browse files
committed
improve docs
1 parent 848e651 commit 42a2b85

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 Tuğrul Topuz
3+
Copyright (c) 2024 Tuğrul Topuz
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,43 @@
11
# node-aline
22

3-
Align last bytes to newline boundary of stream chunks
3+
**Align stream chunks to newline boundaries for seamless processing of structured data streams like JSONLines or CSV.**
44

55
![](https://tugrul.github.io/node-aline/assets/img/node-aline.gif)
66

7-
## Install
7+
## Overview
88

9-
### NPM
9+
`node-aline` is a lightweight library for handling fragmented stream data. It ensures that chunks align at specified separator boundaries, making it ideal for processing newline-delimited formats such as JSONLines, CSV, or logs. This simplifies handling incomplete data in streams, especially in high-performance or real-time applications.
1010

11-
```
11+
---
12+
13+
## Installation
14+
15+
Install using your preferred package manager:
16+
17+
### NPM
18+
```bash
1219
npm install aline
1320
```
1421

1522
### Yarn
16-
17-
```
23+
```bash
1824
yarn add aline
1925
```
2026

21-
## Sample Node.js Stream Transform
27+
---
28+
29+
## Features
30+
- **Stream Alignment**: Guarantees that each chunk aligns to a separator boundary (e.g., `'\n'`).
31+
- **JSONLines & CSV Compatible**: Handles structured stream data efficiently.
32+
- **Node.js & Web Support**: Works seamlessly in both Node.js and browser environments.
33+
34+
---
35+
36+
## Usage Examples
37+
38+
### Node.js Stream Transform
39+
Handle fragmented data in Node.js streams:
40+
2241
```javascript
2342
const {Aline} = require('aline');
2443
const {Readable} = require('stream');
@@ -34,8 +53,11 @@ stream.on('data', function(chunk) {
3453
console.log(chunk.toString());
3554
});
3655
```
56+
---
57+
58+
### Web TransformStream
59+
Process streamed data in the browser:
3760

38-
## Sample Web TransformStream
3961
```javascript
4062
const {AlineWeb} = require('aline');
4163

@@ -55,3 +77,23 @@ async function main() {
5577
}
5678
}
5779
```
80+
81+
---
82+
83+
## When to Use `node-aline`
84+
85+
- **JSONLines Streams**: Align JSON objects split across chunks for seamless parsing.
86+
- **CSV Streams**: Handle incomplete rows in streaming CSV data.
87+
- **Log Processing**: Split logs into individual entries by newline.
88+
- **Real-Time Data Feeds**: Parse and process data on-the-fly from APIs or WebSocket streams.
89+
90+
---
91+
92+
## License
93+
94+
This project is licensed under the MIT License. See the `LICENSE` file for details.
95+
96+
---
97+
98+
## Contributions
99+
Contributions are welcome! Feel free to open issues or submit pull requests to improve the project.

0 commit comments

Comments
 (0)