-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1ac98fb
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github: clue | ||
custom: https://clue.engineering/support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2020 Christian Lück | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is furnished | ||
to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# clue/reactphp-tsv | ||
|
||
Streaming TSV (Tab-Separated Values) parser and encoder for [ReactPHP](https://reactphp.org/). | ||
|
||
## Quickstart example | ||
|
||
TSV (Tab-Separated Values) is a very simple text-based format for storing a | ||
large number of (uniform) records, such as a list of temparature records or log | ||
entries. | ||
|
||
``` | ||
name birthday ip | ||
Alice 2017-01-01 1.1.1.1 | ||
Carol 2006-01-01 2.1.1.1 | ||
Dave 1995-01-01 3.1.1.1 | ||
``` | ||
|
||
Once [installed](#install), you can use the following code to read a TSV stream from `STDIN`: | ||
|
||
```php | ||
$stdin = new React\Stream\ReadableResourceStream(STDIN, $loop); | ||
$stream = new Clue\React\Tsv\Decoder($stdin); | ||
|
||
$stream->on('data', function ($data) { | ||
echo 'Name ' . $data['name'] . '\'s birthday is ' . $data['birthday'] . PHP_EOL; | ||
}); | ||
``` | ||
|
||
You can now process this example by running this on the command line: | ||
|
||
```bash | ||
$ php birthdays.php < users.tsv | ||
Alice's birthday is 2017-01-01 | ||
Carol's birthday is 2006-01-01 | ||
Dave's birthday is 1995-01-01 3.1.1.1 | ||
``` | ||
## Install | ||
[![A clue·access project](https://raw.githubusercontent.com/clue-access/clue-access/main/clue-access.png)](https://github.com/clue-access/clue-access) | ||
*This project is currently under active development, | ||
you're looking at a temporary placeholder repository.* | ||
|
||
Do you want early access to my unreleased projects? | ||
You can either be patient and wait for general availability or | ||
consider becoming a [sponsor on GitHub](https://github.com/sponsors/clue) for early access. | ||
|
||
Do you sponsor me on GitHub? Thank you for supporting sustainable open-source, you're awesome! | ||
The prototype is available here: [https://github.com/clue-access/reactphp-tsv](https://github.com/clue-access/reactphp-tsv). | ||
Support open-source and join [**clue·access**](https://github.com/clue-access/clue-access) ❤️ | ||
## License | ||
This project will be released under the permissive [MIT license](LICENSE). | ||
> Did you know that I offer custom development services and issuing invoices for | ||
sponsorships of releases and for contributions? Contact me (@clue) for details. |