Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ declare module '@vue/runtime-core' {
FormatTransformer: typeof import('./src/components/FormatTransformer.vue')['default']
GitMemo: typeof import('./src/tools/git-memo/git-memo.vue')['default']
'GitMemo.content': typeof import('./src/tools/git-memo/git-memo.content.md')['default']
GzipConverter: typeof import('./src/tools/gzip-converter/gzip-converter.vue')['default']
HashText: typeof import('./src/tools/hash-text/hash-text.vue')['default']
HmacGenerator: typeof import('./src/tools/hmac-generator/hmac-generator.vue')['default']
'Home.page': typeof import('./src/pages/Home.page.vue')['default']
Expand Down Expand Up @@ -130,21 +131,14 @@ declare module '@vue/runtime-core' {
NCode: typeof import('naive-ui')['NCode']
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDivider: typeof import('naive-ui')['NDivider']
NEllipsis: typeof import('naive-ui')['NEllipsis']
NFormItem: typeof import('naive-ui')['NFormItem']
NGi: typeof import('naive-ui')['NGi']
NGrid: typeof import('naive-ui')['NGrid']
NH1: typeof import('naive-ui')['NH1']
NH3: typeof import('naive-ui')['NH3']
NIcon: typeof import('naive-ui')['NIcon']
NInputNumber: typeof import('naive-ui')['NInputNumber']
NLabel: typeof import('naive-ui')['NLabel']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NMenu: typeof import('naive-ui')['NMenu']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSpin: typeof import('naive-ui')['NSpin']
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']
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@
"date-fns": "^2.29.3",
"dompurify": "^3.0.6",
"emojilib": "^3.0.10",
"fflate": "^0.8.2",
"figlet": "^1.7.0",
"figue": "^1.2.0",
"fuse.js": "^6.6.2",
"highlight.js": "^11.7.0",
"iarna-toml-esm": "^3.0.5",
"ibantools": "^4.3.3",
"js-base64": "^3.7.7",
"json5": "^2.2.3",
"jwt-decode": "^3.1.2",
"libphonenumber-js": "^1.10.28",
Expand Down
26 changes: 20 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/components/TextareaCopyable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const props = withDefaults(
language?: string
copyPlacement?: 'top-right' | 'bottom-right' | 'outside' | 'none'
copyMessage?: string
wordWrap?: boolean
}>(),
{
followHeightOf: null,
Expand Down Expand Up @@ -47,7 +48,7 @@ const tooltipText = computed(() => isJustCopied.value ? 'Copied!' : copyMessage.
:style="height ? `min-height: ${height - 40 /* card padding */ + 10 /* negative margin compensation */}px` : ''"
>
<n-config-provider :hljs="hljs">
<n-code :code="value" :language="language" :trim="false" data-test-id="area-content" />
<n-code :code="value" :language="language" :word-wrap="wordWrap" :trim="false" data-test-id="area-content" />
</n-config-provider>
</n-scrollbar>
<div absolute right-10px top-10px>
Expand Down
88 changes: 88 additions & 0 deletions src/tools/gzip-converter/gzip-converter.vue
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions src/tools/gzip-converter/index.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions src/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { tool as basicAuthGenerator } from './basic-auth-generator';
import { tool as asciiTextDrawer } from './ascii-text-drawer';

import { tool as textToUnicode } from './text-to-unicode';
import { tool as gzipConverter } from './gzip-converter';
import { tool as safelinkDecoder } from './safelink-decoder';
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
import { tool as numeronymGenerator } from './numeronym-generator';
Expand Down Expand Up @@ -107,6 +108,7 @@ export const toolsByCategory: ToolCategory[] = [
listConverter,
tomlToJson,
tomlToYaml,
gzipConverter,
],
},
{
Expand Down