Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
webworker-typed
Advanced tools
Dead simple type-safe Web Workers.
npm install webworker-typed
Create a worker file and export the functions you want to expose:
// my-worker.ts
import { exportWorker } from 'webworker-typed';
function foo() { return 'bar'; }
async function asyncFoo() { return 'bar'; }
export default exportWorker({
foo,
asyncFoo,
inline: () => 'bar',
});
From your main thread, import the worker and call the functions:
// main.ts
import { importWorker } from 'webworker-typed';
import type MyWorker from './my-worker.ts';
const untypedWorker = new Worker(new URL('./my-worker.ts', import.meta.url)); // example with webpack
const worker = importWorker<typeof MyWorker>(untypedWorker);
(async () => {
// all imported methods are async
console.assert(await worker.foo() === 'bar');
console.assert(await worker.asyncFoo() === 'bar');
console.assert(await worker.inline() === 'bar');
})();
This project is licensed under the MIT License.
FAQs
Typed Web Workers with Async/Await
The npm package webworker-typed receives a total of 76 weekly downloads. As such, webworker-typed popularity was classified as not popular.
We found that webworker-typed demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.