File tree 3 files changed +72
-0
lines changed
3 files changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { tool as base64FileConverter } from './base64-file-converter';
2
2
import { tool as base64StringConverter } from './base64-string-converter' ;
3
3
import { tool as basicAuthGenerator } from './basic-auth-generator' ;
4
4
import { tool as emailNormalizer } from './email-normalizer' ;
5
+ import { tool as parquetsReader } from './parquets-reader' ;
5
6
6
7
import { tool as asciiTextDrawer } from './ascii-text-drawer' ;
7
8
@@ -160,6 +161,7 @@ export const toolsByCategory: ToolCategory[] = [
160
161
emailNormalizer ,
161
162
regexTester ,
162
163
regexMemo ,
164
+ parquetsReader ,
163
165
] ,
164
166
} ,
165
167
{
Original file line number Diff line number Diff line change
1
+ import { Parking } from '@vicons/tabler' ;
2
+ import { defineTool } from '../tool' ;
3
+
4
+ export const tool = defineTool ( {
5
+ name : 'Parquet files Reader' ,
6
+ path : '/parquets-reader' ,
7
+ description : 'Read parquet file as JSON object arrays' ,
8
+ keywords : [ 'parquet' , 'reader' ] ,
9
+ component : ( ) => import ( './parquets-reader.vue' ) ,
10
+ icon : Parking ,
11
+ createdAt : new Date ( '2025-02-09' ) ,
12
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <script setup lang="ts">
2
+ const fileInput = ref () as Ref <File | null >;
3
+
4
+ const error = ref (' ' );
5
+ const result = ref ([]);
6
+
7
+ const parsedEmailRaw = computedAsync (async () => {
8
+ const file = fileInput .value ;
9
+ error .value = ' ' ;
10
+ if (file == null ) {
11
+ return null ;
12
+ }
13
+ try {
14
+ const reader = await parquet .ParquetReader .openBuffer (await file .arrayBuffer ());
15
+ const cursor = reader .getCursor ();
16
+
17
+ const records = [];
18
+ let record = await cursor .next ();
19
+ while (record ) {
20
+ records .push (record );
21
+ record = await cursor .next ();
22
+ }
23
+
24
+ await reader .close ();
25
+
26
+ result .value = records ;
27
+ }
28
+ catch (e : any ) {
29
+ error .value = e .toString ();
30
+ return null ;
31
+ }
32
+ });
33
+
34
+ function onUpload(file : File ) {
35
+ if (file ) {
36
+ fileInput .value = file ;
37
+ }
38
+ }
39
+ </script >
40
+
41
+ <template >
42
+ <div style =" max-width : 600px ;" >
43
+ <c-card title =" Input" mb-2 >
44
+ <c-file-upload
45
+ title =" Drag and drop Parquet file here, or click to select a file"
46
+ @file-upload =" onUpload"
47
+ />
48
+ </c-card >
49
+
50
+ <c-alert v-if =" error" >
51
+ {{ error }}
52
+ </c-alert >
53
+
54
+ <n-form-item v-if =" !error" label =" Equavalent JSON Content" >
55
+ <textarea-copyable :value =" JSON.stringify(result || [], null, 2)" language =" json" :download-file-name =" `${fileInput.name}.json`" />
56
+ </n-form-item >
57
+ </div >
58
+ </template >
You can’t perform that action at this time.
0 commit comments