
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@naoak/workerize-transferable
Advanced tools
Helper functions for workerlize-loader to support transferables
Helper functions for workerlize-loader to support transferables.
npm i -D workerize-loader
npm i -S @naoak/workerize-transferable
worker.js:
import { setupTransferableMethodsOnWorker } from "@naoak/workerize-transferable";
export function increment(buffer) {
buffer[0] += 1;
return buffer;
}
setupTransferableMethodsOnWorker({
// the name of function which use some transferables
increment: {
// specify an instance of the function
fn: increment,
// pick a transferable object from the result which is an instance of Int32Array
pickTransferablesFromResult: (result) => [result.buffer],
},
});
index.js:
import worker from "workerize-loader!./worker";
import { setupTransferableMethodsOnMain } from "@naoak/workerize-transferable";
let instance = worker(); // `new` is optional
setupTransferableMethodsOnMain({
// worker instance
instance,
// the name of method which use some transferables
increment: {
// pick a transferable object from the method parameters
pickTransferablesFromParams: (params) => [params[0].buffer],
},
});
(async () => {
const buffer = new Int32Array([0]);
const res = await instance.increment(await instance.increment(buffer));
console.log(buffer.length); // 0
console.log(res.length); // 1
console.log(res[0]); // 2
})();
See workerize-loader for details how to setup workerize-loader.
FAQs
Helper functions for workerlize-loader to support transferables
We found that @naoak/workerize-transferable 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
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.