
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Structly is a tool for working with binary data types in JavaScript.
With Structly, you define your data types using a friendly, functional API. These data types are then used to generate optimized code for quickly converting JavaScript objects into their binary representation, and the other way around. Object instances can even be reused, to avoid excessive object allocations and minimize garbage collection!
You can also create "view" objects from your type schemas that automatically update their underlying buffer storage on modification, like magic! This concept is shamelessly inspired by Typed Objects.
Structly supports numbers, booleans, arrays, structs, tuples, bitfields, strings and buffers.
Structly works great in Node (>=4.5.0). A minified UMD build with included shims is also available for browser compatibility. Structly also exposes ES2015 modules for tree-shaking with ES2015-compatible module loaders, such as Rollup or Webpack 2.
import { createConverter, struct, array, float32 } from 'structly';
// A point type with three float32 (single-precision) members.
const point = struct({
x: float32,
y: float32,
z: float32
});
// An array of two points
const points = array(point, 2);
// Prepare some data
const data = [
{ x: 0, y: 1, z: 2 },
{ x: 3, y: 4, z: 5 }
];
// Create a converter for encoding and decoding data
const converter = createConverter(points);
// Encode the JavaScript object into an array buffer
const bytes = converter.encode(data);
// Decode the bytes in the array buffer into a JavaScript object
const decoded = converter.decode(bytes);
All numeric types use the endianness of your system by default. To force either little or big endian, use the provided type constants with the -be or -le suffix.
By default, Structly makes sure accesses are properly aligned.
This results in structs being padded with empty space for performance reasons.
You can override the byte alignment of the struct by passing
{ pack: n } as a second argument to the struct type factory, similar to #pragma pack(n).
FAQs
Tool for working with binary data types in JavaScript
We found that structly demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.