
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
undici-shim
Advanced tools
request
function from Undici within Node, otherwise window.fetch
is utilized when running in a browser environment.Upon trying to distribute a project, I found Undici could not be used on the client-side.
As such, this is a drop-in replacement for Undici when using bundlers like webpack/rollup.
Without the overhead of WHATWG Streams, the request method proves much faster than fetch in both latency and throughput.
Tests | Samples | Results | Tolerance | Difference with slowest |
---|---|---|---|---|
undici - fetch | 20 | 1028.31 req/sec | ± 2.71 % | - |
http - no keepalive | 10 | 3891.51 req/sec | ± 2.00 % | + 278.44 % |
undici - pipeline | 95 | 6034.47 req/sec | ± 2.95 % | + 486.83 % |
http - keepalive | 50 | 6382.57 req/sec | ± 2.98 % | + 520.68 % |
undici - request | 15 | 8528.35 req/sec | ± 2.11 % | + 729.35 % |
npm i undici-shim
import request from 'undici-shim'
const res = await request('https://jsonplaceholder.typicode.com/posts/1')
console.log(await res.body.json())
You can also use Undici fetch instead of request for consistency across environments.
import { fetch } from 'undici-shim'
const res = await fetch('https://jsonplaceholder.typicode.com/posts/1')
console.log(await res.json())
const { fetch } = require('undici-shim')
fetch('https://jsonplaceholder.typicode.com/posts/1')
.then(res => res.json())
.then(console.log)
Node
Starting from v1.3.2, named exports are identical to Undici.
import { request, Dispatcher, Headers, ... } = from 'undici-shim'
Browser
import { fetch, Request, Response, Headers } = from 'undici-shim'
FAQs
Provides Undici request in Node, native fetch in the browser.
We found that undici-shim 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
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.