@cfworker/csv 1.8.3 → 1.11.0
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/dist/encode.d.ts +2 -1
- package/package.json +7 -8
- package/src/encode.ts +3 -6
- package/tsconfig.json +8 -3
- package/LICENSE.md +0 -21
package/dist/encode.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
+
export declare function encode(rows: any[]): ReadableStream;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfworker/csv",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Streaming CSV encoding for Cloudflare Workers and service workers",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,12 +27,11 @@
|
|
|
27
27
|
"test": "cfworker test test/**/*.spec.ts"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@cfworker/dev": "^1.
|
|
31
|
-
"@types/chai": "^4.2.
|
|
32
|
-
"@types/mocha": "^
|
|
30
|
+
"@cfworker/dev": "^1.11.0",
|
|
31
|
+
"@types/chai": "^4.2.22",
|
|
32
|
+
"@types/mocha": "^9.0.0",
|
|
33
33
|
"chai": "^4.3.4",
|
|
34
|
-
"mocha": "^
|
|
35
|
-
"typescript": "^4.2
|
|
36
|
-
}
|
|
37
|
-
"gitHead": "674fb1649bd1686f9918ac90436da709381cffb9"
|
|
34
|
+
"mocha": "^9.1.3",
|
|
35
|
+
"typescript": "^4.5.2"
|
|
36
|
+
}
|
|
38
37
|
}
|
package/src/encode.ts
CHANGED
|
@@ -4,9 +4,9 @@ const delimiter = ',';
|
|
|
4
4
|
const rowDelimiter = '\r\n';
|
|
5
5
|
const requiresQuoteRegex = /["\r\n,]/;
|
|
6
6
|
|
|
7
|
-
export function encode(rows: any[]): ReadableStream
|
|
7
|
+
export function encode(rows: any[]): ReadableStream {
|
|
8
8
|
// Cloudflare Workers cannot construct a ReadableStream
|
|
9
|
-
const { readable, writable } = new TransformStream
|
|
9
|
+
const { readable, writable } = new TransformStream();
|
|
10
10
|
|
|
11
11
|
(async () => {
|
|
12
12
|
const writer = writable.getWriter();
|
|
@@ -17,10 +17,7 @@ export function encode(rows: any[]): ReadableStream<Uint8Array> {
|
|
|
17
17
|
return readable;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async function writeRows(
|
|
21
|
-
writer: WritableStreamDefaultWriter<Uint8Array>,
|
|
22
|
-
rows: any[]
|
|
23
|
-
) {
|
|
20
|
+
async function writeRows(writer: WritableStreamDefaultWriter, rows: any[]) {
|
|
24
21
|
const text = new TextEncoder();
|
|
25
22
|
const utf8 = text.encode.bind(text);
|
|
26
23
|
const write = writer.write.bind(writer);
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../tsconfig-base",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"target": "
|
|
5
|
-
"lib": ["esnext"
|
|
6
|
-
"types": [
|
|
4
|
+
"target": "ES2021",
|
|
5
|
+
"lib": ["esnext"],
|
|
6
|
+
"types": [
|
|
7
|
+
"chai",
|
|
8
|
+
"mocha",
|
|
9
|
+
"@cfworker/worker-types",
|
|
10
|
+
"@cloudflare/workers-types"
|
|
11
|
+
],
|
|
7
12
|
"outDir": "dist",
|
|
8
13
|
"rootDir": "./src"
|
|
9
14
|
},
|
package/LICENSE.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Jeremy Danyow
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|