Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read Generic + Strict & File Length Flags
```ts const gg = await read(new Uint8Array(),{ name: "Level", endian: "big", compression: null, bedrockLevel: null }); ``` This is an experimental demo to add 'generic propagation' to the `read()` function. It doesn't quite work fully because the parameters/options don't quite line up with `Format`, so I'm gonna decide how I want to handle that, since using a boolean for value-based types still seems easiest to use and understand from the user's perspective. I also have to handle the strict flag in the options too. Speaking of that, it might be related to whether the 'strict' flag should propagate to the resulting `NBTData` object & type, which I currently haven't added/fully looked into yet. It may make sense at the type level too though, would definitely be helpful for debugging between types of things! One thing about it is that it would show a type error if you tried opening a non-strict NBT file as a strict one, which thinking of it now, is a great think to also keep track of! Ok, I think I probably will end up adding that with time. Building on that, I may have to add a min file output size/length too, which would ensure that the output file can symmetrically parse to and from it's original content size. If there's any raw unnmanaged bytes in the deadspace for that original file though, those will have to be lost with time. So together, possible `NBTData` strict and file length flags, which would help for symmetrical reads/writes, and would also be helpful for distinguishing parsed files at the type level too :) #29 #31
- Loading branch information