spliterator 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -11
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Spliterator 🎀
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Spliterator is a TypeScript library for streaming delimited content such as CSV, TSV and JSONL.
|
|
4
4
|
|
|
5
|
-
Let's say you have a huge newline-delimited JSON file that can't fit into memory
|
|
5
|
+
Let's say you have a huge newline-delimited JSON file that can't fit into memory:
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
8
|
{"name": "Jessie", "age": 30}
|
|
@@ -11,7 +11,7 @@ Let's say you have a huge newline-delimited JSON file that can't fit into memory
|
|
|
11
11
|
// Several hundred thousand more lines...
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Spliterator can help you read it line-by-line without loading the entire file into memory:
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
17
|
import { JSONSpliterator } from "spliterator"
|
|
@@ -28,7 +28,8 @@ for await (const line of reader) {
|
|
|
28
28
|
}
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
[](https://www.npmjs.com/package/spliterator)
|
|
32
|
+

|
|
32
33
|
|
|
33
34
|
# Installation
|
|
34
35
|
|
|
@@ -42,7 +43,7 @@ npm install spliterator
|
|
|
42
43
|
|
|
43
44
|
## Character-delimited files
|
|
44
45
|
|
|
45
|
-
While
|
|
46
|
+
While Spliterator supports any delimited byte stream, it's particularly useful for character-delimited content such as comma-separated values (CSV), tab-separated values (TSV) – or any other delimiter you can think of.
|
|
46
47
|
|
|
47
48
|
```csv
|
|
48
49
|
Full Name, Occupation, Age
|
|
@@ -81,12 +82,13 @@ for await (const columns of reader) {
|
|
|
81
82
|
|
|
82
83
|
## Advanced usage
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
Spliterator includes a collection of low-level classes and interfaces that can be used to create custom generators for any kind of delimited content.
|
|
86
|
+
|
|
87
|
+
For more advanced usage, check out our tests in the `test` directory, or our fully-annotated source code.
|
|
86
88
|
|
|
87
89
|
### Reading from a stream
|
|
88
90
|
|
|
89
|
-
All
|
|
91
|
+
All included Spliterators implement the `Generator` and `AsyncGenerator` interfaces, so you can use them in `for...of` and `for await...of` loops, as well the web-native [ReadableStreams](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream), so you can use them in `for await...of` loops, as well as piping them through transformations to avoid nested and partially materialized streams.
|
|
90
92
|
|
|
91
93
|
```ts
|
|
92
94
|
import { JSONSpliterator } from "spliterator"
|
|
@@ -107,11 +109,11 @@ for await (const line of stream) {
|
|
|
107
109
|
|
|
108
110
|
### Custom generators
|
|
109
111
|
|
|
110
|
-
While
|
|
112
|
+
While Spliterator includes premade exports for most use-cases, custom generators can be created via `DelimitedGenerator`. This class is a low-level interface that allows you to create your own generators for any kind of delimited content.
|
|
111
113
|
|
|
112
114
|
# License
|
|
113
115
|
|
|
114
|
-
|
|
116
|
+
Spliterator is licensed under the AGPL-3.0 license. Generally,
|
|
115
117
|
this means that you can use the software for free, but you must share
|
|
116
118
|
any modifications you make to the software.
|
|
117
119
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spliterator",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Line-delimited file utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"csv",
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"line-delimited",
|
|
11
11
|
"delimited"
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://github.com/sister-software/
|
|
13
|
+
"homepage": "https://github.com/sister-software/spliterator",
|
|
14
14
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/sister-software/
|
|
15
|
+
"url": "https://github.com/sister-software/spliterator/issues"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git+https://github.com/sister-software/
|
|
19
|
+
"url": "git+https://github.com/sister-software/spliterator.git"
|
|
20
20
|
},
|
|
21
21
|
"license": "AGPL-3.0-only",
|
|
22
22
|
"contributors": [
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
},
|
|
87
87
|
"packageManager": "yarn@4.5.1",
|
|
88
88
|
"engines": {
|
|
89
|
-
"node": ">=
|
|
89
|
+
"node": ">= 20.18.1"
|
|
90
90
|
},
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public",
|