Giter Site home page Giter Site logo

construct-js's Issues

Question: Does it work with floats?

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).

fromBuffer()?

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.

New uInt64 field

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.

Typing the added properties

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.

Version TS>=5

Equivalent code for Version TS<5

"Word" size + naming

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.