
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
cloud-worker
Advanced tools
This project is based on the ideas from the Service Worker specification and the CloudFlare Worker project.
This project is based on the ideas from the Service Worker specification and the CloudFlare Worker project.
Create a single worker file that accepts a fetch event and calls event.respondWith with a promise (such as another fetch).
The module can be used as a standalone server (possibly to test CloudFlare Workers) or as middleware in your own projects or can be invoked manually.
Cloud Worker requires Node and is installed using npm (which comes with node):
npm install cloud-worker
If you want to only write a cloud worker file, then you can use the prebuilt server in your npm scripts like this:
{
"scripts": {
"start": "worker index.js"
}
}
…where index.js contains your worker. For example, this cloud-worker demo waits 3 seconds then sends all request the response from a example.com (source code).
Here's some recipes of what a cloud worker can do.
The module can be required and used directly, and the (current) API is:
const worker = require('cloud-worker');
The cloud worker uses Node's vm module to globally scope all of the required API that the service worker-like script would expect.
It waits for a single addEventListener for the fetch event and triggers that event when the worker.handler function is invoked passing in a event that contains a request object.
The functionality is provided via the following npm modules:
fetch (and related sub modules including Request, Response, Headers, FetchError) via node-fetchResponse.redirect is manually addedURL and URLSearchParams via node's internal url packageReadableStream, WritableStream and TransformStream) via web-streams-polyfill (though I believe this to be out of date - any user contribution would be grateful here)TextEncoder and TextDecoder) via text-encodingFetchEvent is manually addedFAQs
This project is based on the ideas from the Service Worker specification and the CloudFlare Worker project.
We found that cloud-worker 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.