
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Fetchoraw is a small library to rewrite asset URLs in HTML.
You can replace src, href, and other attributes using your own resolver.
npm install fetchoraw
import { Fetchoraw } from 'fetchoraw';
const resolver = async (url: string) =>
url.replace('https://cdn.example.com/', '/assets/');
const fetchoraw = new Fetchoraw(resolver);
const { html, map } = await fetchoraw.html(
'<img src="https://cdn.example.com/logo.png">'
);
console.log(html); // <img src="/assets/logo.png">
console.log(map); // [{ url: 'https://cdn.example.com/logo.png', resolvedPath: '/assets/logo.png' }]
const fetchoraw = new Fetchoraw(resolver);
const result = await fetchoraw.url('https://cdn.example.com/logo.png');
console.log(result.path); // /assets/logo.png
Fetchorawnew Fetchoraw(resolver, options?)
resolver: (url: string, options?: RequestInit) => Promise<string | { path: string, data?: unknown }> options.envModeName?: env var name to control rewriting (default: PUBLIC_FETCHORAW_MODE)options.enableFetchEnvValue?: value to enable rewriting (default: FETCH)options.enableCacheEnvValue?: value to read from cache (default: CACHE)options.cacheFilePath?: file to store cache (default: cache/fetchoraw_cache.json)html(html: string, config?)config.selectors?: selectors/attributes to rewrite (default presets: img[src], source[srcset], etc.){ html, map }url(url: string, origin?, fetchOptions?){ path, data?, map }You can use any of the included resolvers depending on your use case:
createImageDataUrlResolver()Fetches and inlines assets as base64 data: URLs.
import { createImageDataUrlResolver } from 'fetchoraw/resolvers';
const resolver = createImageDataUrlResolver();
Options:
inlineLimitBytes: max size to inline (default: 2MB)allowMimeTypes: allowed types (default: image/audio/video/pdf)createImageFileSaveResolver()Saves remote assets to the local filesystem.
import { createImageFileSaveResolver } from 'fetchoraw/resolvers';
const resolver = createImageFileSaveResolver({
saveRoot: 'public/assets',
prependPath: 'assets'
});
Options:
saveRoot: root folder to store files (default: dist/assets)prependPath: prefix in rewritten paths (default: assets)keyString: pattern to strip from saved paths (default: URL base)createImageSmartResolver()Combines data: and file saving based on file size and URL pattern.
import { createImageSmartResolver } from 'fetchoraw/resolvers';
const resolver = createImageSmartResolver({
inlineLimitBytes: 500000,
requireFilePatterns: [/\.svg$/]
});
requireFilePatterns are saved to filecreateJsonFileSaveResolver()Fetches JSON and saves both the file and parsed data.
import { createJsonFileSaveResolver } from 'fetchoraw/resolvers';
const resolver = createJsonFileSaveResolver();
Useful for working with CMS APIs, feeds, config files, etc.
MIT
FAQs
A simple resolver-based URL transformer for Astro and CMS-driven projects.
We found that fetchoraw demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.