
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
sharedarray
Advanced tools
Run npm install sharedarray in your project
Require using
const SharedArray = require('sharedarray')
let array = new SharedArray()
await array.set(10, 500)
let a = await array.get(10) // a = 500
await array.concatenate(0, [1, 2, 3])
let x = await array.get(0) // x = 1
let y = await array.get(1) // y = 2
let z = await array.get(2) // z = 3
let array2
//export array
let exportData = array.export((syncData) => {
array2.sync(syncData)
})
//send that exportData to another thread/worker and then re-recreate array object
array2 = new SharedArray(exportData, (syncData) => {
array.sync(syncData)
})
let b = await array2.get(10) // b = 500
The two objects need to be able to sync with each other over different threads. You therefore need to pass a sync function upon exporting, you will need to send the data to the other objects sync function.
That also needs to happen in reverse, so when creating the second array you need to pass the sync function of the first object.
When using workers you will need to send this data using the postMessage function.
The functions give you a the indexNumber and the buffer, this not actual data but rather a pointer.
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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.