Team-Lodestone / nbt-edit

NBT editor & lightweight viewer component for the web.

Home Page:https://team-lodestone.github.io/nbt-edit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nbt editor && viewer component for the web.

<script lang="ts">
	import 'compression-streams-polyfill';
	import { Viewer } from '$lib';

	let files: FileList | undefined;
	let data: Promise<Uint8Array> | undefined;

	$: if (files) {
		data = files[0].arrayBuffer().then((buffer) => new Uint8Array(buffer));
	} else {
		data = undefined;
	}
</script>

<input type="file" accept=".nbt" bind:files />

{#await data}
	<p>Loading...</p>
{:then data}
	<Viewer {data} />
{:catch error}
	<p>{error}</p>
{/await}

polyfill

The internal library that nbt-edit uses, NBTify, uses Compression and Decompression streams.
These are not supported in all browsers. If you are using nbt-edit in a browser that does not support these streams, you will need to include a polyfill.

The reccomended polyfill is compression-streams-polyfill, as it works well with SvelteKit.

Firefox does not support these streams, and Chrome supports them only in version 80 and above.

About

NBT editor & lightweight viewer component for the web.

https://team-lodestone.github.io/nbt-edit/

License:MIT License


Languages

Language:Svelte 68.7%Language:TypeScript 15.8%Language:JavaScript 11.7%Language:HTML 3.8%