memorymap
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

MemoryMap

A class wrapper for mapping class properties into a buffer.

class Map extends MemoryMap {
  @Field(Byte) // 1
  Id: number;
 
  @Field(UInt) // 4
  Id2: number;
 
  @Field(BString(15)) // 16
  Name: string;
}
 
const Buff = Buffer.alloc(Map.Size); // 21
 
const a = new Map(Buff);
 
console.log(Buff);
a.Id = 12;
console.log(Buff);
a.Name = "Test Acc";
console.log(Buff);

Package Sidebar

Install

npm i memorymap

Weekly Downloads

0

Version

1.0.9

License

MIT

Unpacked Size

12.5 kB

Total Files

16

Last publish

Collaborators

  • kaaninel