Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
fetch-event
Advanced tools
FetchEvent outside Service Worker
Simple http mocking
var nodeFetch = require('node-fetch')
var {fetch, Response} = require('./node')(nodeFetch)
fetch.on('fetch', event => {
console.log(event.request.url) // http://example.com
event.respondWith(new Response('hello'))
})
fetch('http://example.com')
.then(res => res.text())
.then(console.log) // hello
Using fetch-cachestorage you can create your own cache mechanism
var nodeFetch = require('node-fetch')
var {fetch, Response} = require('./node')(nodeFetch)
/*
* Will see if it exist in the cache, if not it will fetch it
* store it, and respond with a copy - secound time it will load
* from the cache
*/
fetch.on('fetch', event => event.respondWith(
caches.match(event.request).then(res =>
res || nodeFetch(event.request).then(res =>
caches.open('v1').then(cache => (
cache.put(event.request, res.clone()), res
))
)
)
))
FAQs
FetchEvent outside Service Worker
The npm package fetch-event receives a total of 4 weekly downloads. As such, fetch-event popularity was classified as not popular.
We found that fetch-event 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.