Merge branch 'feat/gzip' into chore/all-my-stuffs

# Conflicts:
#	components.d.ts
#	package.json
#	pnpm-lock.yaml
#	src/components/TextareaCopyable.vue
#	src/tools/index.ts
This commit is contained in:
ShareVB committed 2024-11-03 22:47:39 +01:00
commit 310073a4a0
5 files changed
+112 -2

No files matched your search

+2
View File
@@ -154,6 +154,7 @@
"fast_array_intersect": "^1.1.0",
"exif-be-gone": "^1.5.1",
"event-cron-parser": "^1.0.34",
"fflate": "^0.8.2",
"figlet": "^1.7.0",
"figue": "^1.2.0",
"flatten-anything": "^4.0.1",
@@ -190,6 +191,7 @@
"json2csharp": "^1.0.3",
"js-base64": "^3.7.7",
"ical.js": "^2.0.1",
"js-base64": "^3.7.7",
"json5": "^2.2.3",
"jsonpath": "^1.1.1",
"jsonar-mod": "^1.9.0",
+8 -2
View File
@@ -278,6 +278,9 @@ dependencies:
fast_array_intersect:
specifier: ^1.1.0
version: 1.1.0
fflate:
specifier: ^0.8.2
version: 0.8.2
figlet:
specifier: ^1.7.0
version: 1.7.0
@@ -5250,7 +5253,7 @@ packages:
/@types/lodash-es@4.17.10:
resolution: {integrity: sha512-YJP+w/2khSBwbUSFdGsSqmDvmnN3cCKoPOL7Zjle6s30ZtemkkqhjVfFqGwPN7ASil5VyjE2GtyU/yqYY6mC0A==}
dependencies:
'@types/lodash': 4.14.200
'@types/lodash': 4.14.192
dev: false
/@types/lodash.defaultsdeep@4.6.9:
@@ -5273,7 +5276,6 @@ packages:
/@types/lodash@4.14.192:
resolution: {integrity: sha512-km+Vyn3BYm5ytMO13k9KTp27O75rbQ0NFw+U//g+PX7VZyjCioXaRFisqSIJRECljcTv73G3i6BpglNGHgUQ5A==}
dev: true
/@types/lodash@4.14.200:
resolution: {integrity: sha512-YI/M/4HRImtNf3pJgbF+W6FrXovqj+T+/HpENLTooK9PnkacBsDpeP3IpHab40CClUfhNmdM2WTNP2sa2dni5Q==}
@@ -9098,6 +9100,10 @@ packages:
node-domexception: 1.0.0
web-streams-polyfill: 3.2.1
/fflate@0.8.2:
resolution: {integrity: sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==}
dev: false
/figlet@1.7.0:
resolution: {integrity: sha512-gO8l3wvqo0V7wEFLXPbkX83b7MVjRrk1oRLfYlZXol8nEpb/ON9pcKLI4qpBv5YtOTfrINtqb7b40iYY2FTWFg==}
engines: {node: '>= 0.4.0'}
@@ -0,0 +1,88 @@
<script setup lang="ts">
import * as fflate from 'fflate';
import { Base64 } from 'js-base64';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
import { withDefaultOnError } from '@/utils/defaults';
const compressedInput = ref('');
const decompressedOutput = computed(() => withDefaultOnError(() => {
const compressedBuf = Base64.toUint8Array(compressedInput.value);
return fflate.strFromU8(fflate.decompressSync(compressedBuf));
}, '# invalid compressed base64 string'));
const rawInput = ref('');
const compressedGzipOutput = computed(() => withDefaultOnError(() => Base64.fromUint8Array(fflate.gzipSync(fflate.strToU8(rawInput.value))), ''));
const compressedDeflateOutput = computed(() => withDefaultOnError(() => Base64.fromUint8Array(fflate.deflateSync(fflate.strToU8(rawInput.value))), ''));
const compressedZlibOutput = computed(() => withDefaultOnError(() => Base64.fromUint8Array(fflate.zlibSync(fflate.strToU8(rawInput.value))), ''));
</script>
<template>
<div style="max-width: 600px;">
<c-card title="Compress string" mb-5>
<c-input-text
v-model:value="rawInput"
multiline
placeholder="Put your string here..."
rows="5"
label="String to compress"
raw-text
mb-5
/>
<div>
<h3>GZIP compressed string</h3>
<TextareaCopyable
:value="compressedGzipOutput"
:word-wrap="true"
multiline
placeholder="The GZip compressed version of your string will be here"
mb-5
/>
</div>
<div>
<h3>Zlib compressed string</h3>
<TextareaCopyable
:value="compressedZlibOutput"
:word-wrap="true"
multiline
placeholder="The Zlib compressed version of your string will be here"
mb-5
/>
</div>
<div>
<h3>Deflate compressed string</h3>
<TextareaCopyable
:value="compressedDeflateOutput"
:word-wrap="true"
multiline
placeholder="The Deflate compressed version of your string will be here"
mb-5
/>
</div>
</c-card>
<c-card title="Decompress string">
<c-input-text
v-model:value="compressedInput"
multiline
placeholder="Your compressed string..."
rows="5"
label="Compressed string to decompress"
mb-5
/>
<div>
<h3>Decompressed string</h3>
<TextareaCopyable
v-model:value="decompressedOutput"
:word-wrap="true"
multiline
placeholder="The decompressed string will be here"
mb-5
/>
</div>
</c-card>
</div>
</template>
+12
View File
@@ -0,0 +1,12 @@
import { FileZip } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'GZip/Deflate converter',
path: '/gzip-converter',
description: 'Convert text from/to gzip/deflate',
keywords: ['gzip', 'deflate', 'converter'],
component: () => import('./gzip-converter.vue'),
icon: FileZip,
createdAt: new Date('2024-03-09'),
});
+2
View File
@@ -70,6 +70,7 @@ import { tool as crcCalculator } from './crc-calculator';
import { tool as ipGeoLocation } from './ip-geo-location';
import { tool as ocrImage } from './ocr-image';
import { tool as ansibleVaultCryptDecrypt } from './ansible-vault-crypt-decrypt';
import { tool as gzipConverter } from './gzip-converter';
import { tool as safelinkDecoder } from './safelink-decoder';
import { tool as mongoObjectidConverter } from './mongo-objectid-converter';
import { tool as removeExif } from './remove-exif';
@@ -290,6 +291,7 @@ export const toolsByCategory: ToolCategory[] = [
weekNumberConverter,
xmlToJson,
jsonToXml,
gzipConverter,
],
},
{