Compare commits

..
Author SHA1 Message Date
sharevb 61bfd2a360 feat(new tool): Parquet File Reader
Fix #1516
2025-03-16 19:12:37 +01:00
8 changed files with 125 additions and 143 deletions

No files matched your search

+8 -1
View File
@@ -15,7 +15,6 @@ declare module '@vue/runtime-core' {
AsciiTextDrawer: typeof import('./src/tools/ascii-text-drawer/ascii-text-drawer.vue')['default']
'Base.layout': typeof import('./src/layouts/base.layout.vue')['default']
Base64FileConverter: typeof import('./src/tools/base64-file-converter/base64-file-converter.vue')['default']
Base64HexConverter: typeof import('./src/tools/base64-hex-converter/base64-hex-converter.vue')['default']
Base64StringConverter: typeof import('./src/tools/base64-string-converter/base64-string-converter.vue')['default']
BasicAuthGenerator: typeof import('./src/tools/basic-auth-generator/basic-auth-generator.vue')['default']
Bcrypt: typeof import('./src/tools/bcrypt/bcrypt.vue')['default']
@@ -131,21 +130,29 @@ declare module '@vue/runtime-core' {
MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default']
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
NButton: typeof import('naive-ui')['NButton']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCode: typeof import('naive-ui')['NCode']
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDataTable: typeof import('naive-ui')['NDataTable']
NDivider: typeof import('naive-ui')['NDivider']
NEllipsis: typeof import('naive-ui')['NEllipsis']
NFormItem: typeof import('naive-ui')['NFormItem']
NH1: typeof import('naive-ui')['NH1']
NH3: typeof import('naive-ui')['NH3']
NIcon: typeof import('naive-ui')['NIcon']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NMenu: typeof import('naive-ui')['NMenu']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSpace: typeof import('naive-ui')['NSpace']
NTable: typeof import('naive-ui')['NTable']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
ParquetsReader: typeof import('./src/tools/parquets-reader/parquets-reader.vue')['default']
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
PdfSignatureChecker: typeof import('./src/tools/pdf-signature-checker/pdf-signature-checker.vue')['default']
PdfSignatureDetails: typeof import('./src/tools/pdf-signature-checker/components/pdf-signature-details.vue')['default']
+2 -2
View File
@@ -46,7 +46,6 @@
"@tiptap/starter-kit": "2.1.6",
"@tiptap/vue-3": "2.0.3",
"@types/figlet": "^1.5.8",
"@types/hex-array": "^1.0.2",
"@types/markdown-it": "^13.0.7",
"@vicons/material": "^0.12.0",
"@vicons/tabler": "^0.12.0",
@@ -68,8 +67,9 @@
"figlet": "^1.7.0",
"figue": "^1.2.0",
"fuse.js": "^6.6.2",
"hex-array": "^1.0.0",
"highlight.js": "^11.7.0",
"hyparquet": "^1.9.0",
"hyparquet-compressors": "^1.0.0",
"iarna-toml-esm": "^3.0.5",
"ibantools": "^4.3.3",
"js-base64": "^3.7.6",
+25 -14
View File
@@ -32,9 +32,6 @@ dependencies:
'@types/figlet':
specifier: ^1.5.8
version: 1.7.0
'@types/hex-array':
specifier: ^1.0.2
version: 1.0.2
'@types/markdown-it':
specifier: ^13.0.7
version: 13.0.9
@@ -98,12 +95,15 @@ dependencies:
fuse.js:
specifier: ^6.6.2
version: 6.6.2
hex-array:
specifier: ^1.0.0
version: 1.0.0
highlight.js:
specifier: ^11.7.0
version: 11.11.1
hyparquet:
specifier: ^1.9.0
version: 1.9.0
hyparquet-compressors:
specifier: ^1.0.0
version: 1.0.0
iarna-toml-esm:
specifier: ^3.0.5
version: 3.0.5
@@ -3140,10 +3140,6 @@ packages:
resolution: {integrity: sha512-C3YYeRQWp2fmq9OryX+FoDy8nXS6scQ7dPptD8LnFDAUNcKWJjXQKDNJD3HVm+kOUsXhTOkpi69vI4EuAr95bA==}
dev: true
/@types/hex-array@1.0.2:
resolution: {integrity: sha512-H1QsLqz6k9QTioutUQUiBiyM4CMmE6A1prXHGotw42j8sN5H/ScC5OxIbcrXnipikrJ5Qn3aozWb9UXBKUscJQ==}
dev: false
/@types/jsdom@21.1.7:
resolution: {integrity: sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==}
dependencies:
@@ -6242,6 +6238,10 @@ packages:
hasBin: true
dev: true
/fzstd@0.1.1:
resolution: {integrity: sha512-dkuVSOKKwh3eas5VkJy1AW1vFpet8TA/fGmVA5krThl8YcOVE/8ZIoEA1+U1vEn5ckxxhLirSdY837azmbaNHA==}
dev: false
/gensync@1.0.0-beta.2:
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'}
@@ -6502,10 +6502,6 @@ packages:
tslib: 2.8.1
dev: false
/hex-array@1.0.0:
resolution: {integrity: sha512-dbjcApZ+RBr2DYCqs2gab5So6q4rM5VBqFg8oeOPc/s8PzrD48pf4w9e7DC4G+Gq4CEkHYQxqn7uYAQZKVWo8w==}
dev: false
/highlight.js@11.11.1:
resolution: {integrity: sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==}
engines: {node: '>=12.0.0'}
@@ -6588,6 +6584,21 @@ packages:
- supports-color
dev: true
/hyparquet-compressors@1.0.0:
resolution: {integrity: sha512-cKueptWa8P9oXX3DMlLoHHXl4DWHvEJwXihb30vXJVJWMSrDsEK6v1v455vW1g3nF+b3THYWpRT3pi++YB4sOg==}
dependencies:
fzstd: 0.1.1
hysnappy: 1.0.0
dev: false
/hyparquet@1.9.0:
resolution: {integrity: sha512-StgrDzLnawgI+z01IP5u1yEpVexlgBSG6mnyeFngzEHw8z11rWW262yA5yGfhjVvgRoeUMZZQotCboz9WEWETg==}
dev: false
/hysnappy@1.0.0:
resolution: {integrity: sha512-MNrC4NfwDGPb889O6gIfEtbvEZCSWUsSEhsz4Oq2FRcpGtXHfeVz3KciSPp5Pnnz1NjFMgDQNfxdJozymJEDDA==}
dev: false
/iarna-toml-esm@3.0.5:
resolution: {integrity: sha512-CgeDbPohnFG827UoRaCqKxJ8idiIDZDWlcHf5hUReQnZ8jHnNnhN4QJFiY12fKvr0LvuDuKAimqQfrmQnacbtw==}
dependencies:
@@ -1,112 +0,0 @@
<script setup lang="ts">
import Base64 from 'js-base64';
import hexArray from 'hex-array';
import { useCopy } from '@/composable/copy';
import { isValidBase64 } from '@/utils/base64';
const textInput = ref('');
const base64Output = computed(() => {
try {
return Base64.fromUint8Array(hexArray.fromString(textInput.value));
}
catch (e: any) {
return e.toString();
}
});
const { copy: copyTextBase64 } = useCopy({ source: base64Output, text: 'Base64 Hex Array copied to the clipboard' });
const uppercase = ref(false);
const grouping = ref(0);
const rowlength = ref(0);
const base64Input = ref('');
const textOutput = computed(() => {
try {
return hexArray.toString(Base64.toUint8Array(base64Input.value), {
uppercase: uppercase.value,
grouping: grouping.value,
rowlength: rowlength.value,
});
}
catch (e: any) {
return e.toString();
}
},
);
const { copy: copyText } = useCopy({ source: textOutput, text: 'Hex Array copied to the clipboard' });
const b64ValidationRules = [
{
message: 'Invalid base64 string',
validator: (value: string) => isValidBase64(value.trim()),
},
];
</script>
<template>
<c-card title="Hex Array to Base64">
<c-input-text
v-model:value="textInput"
multiline
placeholder="Put your Hex Array here..."
rows="5"
label="Hex Array to encode"
raw-text
mb-5
/>
<c-input-text
label="Base64 of Hex Array"
:value="base64Output"
multiline
readonly
placeholder="The base64 encoding of your Hex Array will be here"
rows="5"
mb-5
/>
<div flex justify-center>
<c-button @click="copyTextBase64()">
Copy base64
</c-button>
</div>
</c-card>
<c-card title="Base64 to Hex Array">
<n-space align="baseline" justify="center" mb-1>
<n-form-item label="Uppercase" label-placement="left">
<n-switch v-model:value="uppercase" />
</n-form-item>
<n-form-item label="Group by" label-placement="left">
<n-input-number v-model:value="grouping" :min="0" style="width: 6em" mr-1 /> digits (0 = no grouping)
</n-form-item>
<n-form-item label="Split as rows by" label-placement="left">
<n-input-number v-model:value="rowlength" :min="0" style="width: 6em" mr-1 /> group of digits (0 = no rows)
</n-form-item>
</n-space>
<c-input-text
v-model:value="base64Input"
multiline
placeholder="Your base64 Hex Array..."
rows="5"
:validation-rules="b64ValidationRules"
label="Base64 Hex Array to decode"
mb-5
/>
<c-input-text
v-model:value="textOutput"
label="Decoded Hex Array"
placeholder="The decoded Hex Array will be here"
multiline
rows="5"
readonly
mb-5
/>
<div flex justify-center>
<c-button @click="copyText()">
Copy decoded Hex Array
</c-button>
</div>
</c-card>
</template>
-12
View File
@@ -1,12 +0,0 @@
import { FileDigit } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Base64 Hex array encoder/decoder',
path: '/base64-hex-converter',
description: 'Simply encode and decode Hex array into a their base64 representation.',
keywords: ['base64', 'converter', 'conversion', 'web', 'data', 'format', 'atob', 'btoa', 'hex'],
component: () => import('./base64-hex-converter.vue'),
icon: FileDigit,
createdAt: new Date('2025-02-09'),
});
+2 -2
View File
@@ -2,7 +2,7 @@ import { tool as base64FileConverter } from './base64-file-converter';
import { tool as base64StringConverter } from './base64-string-converter';
import { tool as basicAuthGenerator } from './basic-auth-generator';
import { tool as emailNormalizer } from './email-normalizer';
import { tool as base64HexConverter } from './base64-hex-converter';
import { tool as parquetsReader } from './parquets-reader';
import { tool as asciiTextDrawer } from './ascii-text-drawer';
@@ -102,7 +102,6 @@ export const toolsByCategory: ToolCategory[] = [
romanNumeralConverter,
base64StringConverter,
base64FileConverter,
base64HexConverter,
colorConverter,
caseConverter,
textToNatoAlphabet,
@@ -162,6 +161,7 @@ export const toolsByCategory: ToolCategory[] = [
emailNormalizer,
regexTester,
regexMemo,
parquetsReader,
],
},
{
+12
View File
@@ -0,0 +1,12 @@
import { Parking } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Parquet files Reader',
path: '/parquets-reader',
description: 'Read parquet file as JSON object arrays',
keywords: ['parquet', 'reader'],
component: () => import('./parquets-reader.vue'),
icon: Parking,
createdAt: new Date('2025-02-09'),
});
@@ -0,0 +1,76 @@
<script setup lang="ts">
// import { Buffer } from 'node:buffer';
import { parquetReadObjects } from 'hyparquet';
import { compressors } from 'hyparquet-compressors';
import type { DataTableInst } from 'naive-ui';
const fileInput = ref() as Ref<File | null>;
const error = ref('');
const results = computedAsync(async () => {
const file = fileInput.value;
error.value = '';
if (file == null) {
return null;
}
try {
return await parquetReadObjects({ file: await file.arrayBuffer(), compressors });
}
catch (e: any) {
error.value = e.toString();
return [];
}
});
const resultsJson = computed(() => JSON.stringify(results.value || [], (_, v) => typeof v === 'bigint' ? v.toString() : v, 2));
const columns = computed(() => Object.keys((results.value || [])[0] || {})
.map(h => ({ key: h.replace(/\./g, '\\.'), title: h })));
function onUpload(file: File) {
if (file) {
fileInput.value = file;
}
}
const tableRef = ref<DataTableInst>();
function downloadCsv() {
tableRef.value?.downloadCsv({ fileName: fileInput.value?.name || 'data' });
}
</script>
<template>
<div style="max-width: 600px;">
<c-card title="Input" mb-2>
<c-file-upload
title="Drag and drop Parquet file here, or click to select a file"
@file-upload="onUpload"
/>
</c-card>
<c-alert v-if="error">
{{ error }}
</c-alert>
<n-tabs v-if="!error" type="line" animated>
<n-tab-pane name="jsonData" tab="JSON Content">
<textarea-copyable :value="resultsJson" language="json" :download-file-name="`${fileInput?.name}.json`" />
</n-tab-pane>
<n-tab-pane v-if="columns.length" name="tabData" tab="Table View">
<div mb-1 flex justify-center>
<n-button @click="downloadCsv">
Export as CSV
</n-button>
</div>
<n-data-table
ref="tableRef"
size="small"
:columns="columns"
:data="results" bordered striped
pagination
/>
</n-tab-pane>
</n-tabs>
</div>
</template>