francisrstokes / construct-js Goto Github PK
View Code? Open in Web Editor NEW๐ ๏ธA library for creating byte level data structures.
License: MIT License
๐ ๏ธA library for creating byte level data structures.
License: MIT License
Document the types.
Thank you for the library. I was wondering to know if this library works with floats or is a way to serialize single or double precision numbers and restore them for later ( with some loss of precision).
First, this looks amazing and is just what I need to keep my binary structs sane!
Is there a `fromBuffer()? If I receive one of these in Buffer form, is there a way to load it into a Struct? I see a few get methods, but not any set ones.
Would be great to have a Int64/uInt64-Field. We would read it from the database as a string that contains a 64-bit number (f.e. "9223372036854775807") and it is somehow converted into a 64 bit long buffer that contains the value 7FFF,FFFF,FFFF,FFFF.
and instead expose functions like U16LE
and S32BE
instead. The internal API can stay the same.
Hello, I'm wondering if you would consider typing the added fields in TS, I just made an experiment here below as an example:
In this way, we can write the following code
const struct = new Struct()
.field("hello", "world")
.field("foo", "bar")
.build();
struct.hello // okay -> world
struct.foo // okay -> bar
struct.nope // error
This is just to show a possible way of adding properties by chaining to a type using ts.
Equivalent code for Version TS<5
Using a Word
as 16-bits is a bit outdated and I think it can be more generalized + future proof. Is it possible to rename it to something like iWord16
or uWord32
to differentiate between signed and unsigned and specify the total number of bits being used?
(using this issue to record notes/ideas)
Just like RawString, but with the extra byte.
If ArrayBuffer is used, construct-js could be used in the browser as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.