
Security News
curl Shuts Down Bug Bounty Program After Flood of AI Slop Reports
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.
shared-structs
Advanced tools
Share a struct backed by the same underlying buffer between C and JavaScript
npm install shared-struct
Useful for doing bulk updates of data in native modules with no context switching cost.
const sharedStructs = require('shared-structs')
const structs = sharedStructs(`
struct aStruct {
int32_t i;
char buf[1024];
char someChar;
int someInt;
}
`)
const struct = structs.aStruct()
struct.i = 42
struct.buf[0] = 42
// pass this to c, and it will be able to parse it
console.log(struct.rawBuffer)
See example/example.js for more.
structs = sharedStructs(src)Parses the structs specified in the global scope of src and returns JavaScript implementations of each.
Each property is exposed as a normal JavaScript property you can get/set.
All changes are reflected in .rawBuffer which you can pass to a c program
and parse with the same struct.
There is a small helper included in require('shared-structs/strings') that
allows you to encode/decode c style strings into char buffers
const strings = require('shared-structs/strings')
// encode
strings.encode('hello world', struct.buf)
// decode
console.log(strings.decode(struct.buf))
MIT
FAQs
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
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.