
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
cloudflare-assets-kv
Advanced tools
A simple library to serve and dynamically update static assets from Cloudflare KV storage in your Workers.
A simple library to serve and dynamically update static assets from Cloudflare KV storage in your Workers.
Add an ASSETS_KV namespace to your wrangler.toml:
[[kv_namespaces]]
binding = "ASSETS_KV"
id = "your-kv-namespace-id"
npm install cloudflare-assets-kv
import { withAssetsKV } from "cloudflare-assets-kv";
export default {
fetch: withAssetsKV(
async (request, env, ctx) => {
// Your worker code here
return new Response("Not Found", { status: 404 });
},
{
excludePaths: ["/api/"], // Optional: paths to exclude from KV lookup
},
),
};
Create a .assetsignore
file in your project root to exclude files and directories:
node_modules
.wrangler
.git
.DS_Store
Alternatively, place your assets in a public
directory.
Put your static assets in the project root (or public directory).
npx uploadkv
Options:
--dryrun
: Show what would be uploaded without uploading--local
: Use local KV storage for developmentYou can read and write assets directly in your worker code:
// Read an asset
const asset = await env.ASSETS_KV.get("index.html", { type: "text" });
// Update an asset
await env.ASSETS_KV.put("index.html", newContent, {
metadata: {
contentType: "text/html",
updated: new Date().toISOString(),
},
});
The withAssetsKV
middleware accepts these options:
{
kvNamespace: "ASSETS_KV", // KV namespace binding name
excludePaths: [], // Paths to exclude from asset handling
pathPrefix: "", // Path prefix to add when looking up assets in KV
cacheControl: "public, max-age=31536000", // Cache control header value
browserTTL: 31536000, // Browser cache TTL in seconds
includeHost: false // Whether to include hostname in the KV key
}
FAQs
A simple library to serve and dynamically update static assets from Cloudflare KV storage in your Workers.
The npm package cloudflare-assets-kv receives a total of 1 weekly downloads. As such, cloudflare-assets-kv popularity was classified as not popular.
We found that cloudflare-assets-kv 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.