
Research
Node.js Fixes AsyncLocalStorage Crash Bug That Could Take Down Production Servers
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.
@cameronhunter/json-async-stringify
Advanced tools
JSON stringify with support for an async replacer function
@cameronhunter/json-async-stringifyJSON stringify with support for an async replacer function.
The standard JSON.stringify() accepts a replacer function to transform values before serialization, but it doesn't support async operations. This package provides an asyncStringify function that allows you to use an async replacer function, enabling you to perform asynchronous operations like fetching data from APIs, databases, or other async sources during the stringification process.
npm install @cameronhunter/json-async-stringify
import { asyncStringify } from '@cameronhunter/json-async-stringify';
const userIds = [{ id: 1 }, { id: 2 }, { id: 3 }];
// Fetch full user details for each ID
const json = await asyncStringify(userIds, async (_key, value) => {
if (typeof value === 'object' && value !== null && 'id' in value && !('name' in value)) {
// Fetch user details from an API
const response = await fetch(`https://api.example.com/users/${value.id}`);
return response.json();
}
return value;
});
console.log(json);
// [{"id":1,"name":"Alice","email":"alice@example.com"},{"id":2,"name":"Bob","email":"bob@example.com"},...]
import { asyncStringify } from '@cameronhunter/json-async-stringify';
const product = {
name: 'Coffee Mug',
price: 12.99,
image: 'https://example.com/images/mug.jpg',
thumbnail: 'https://example.com/images/mug-thumb.jpg',
};
// Convert image URLs to inline base64 data URLs
const json = await asyncStringify(product, async (key, value) => {
// Check if this looks like an image URL
if (typeof value === 'string' && /^https?:\/\/.+\.(jpg|jpeg|png|gif|webp)$/i.test(value)) {
// Fetch the image
const response = await fetch(value);
const arrayBuffer = await response.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
// Convert to base64
const base64 = buffer.toString('base64');
const contentType = response.headers.get('content-type') || 'image/jpeg';
// Return as data URL
return `data:${contentType};base64,${base64}`;
}
return value;
});
console.log(json);
// {"name":"Coffee Mug","price":12.99,"image":"data:image/jpeg;base64,/9j/4AAQ...","thumbnail":"data:image/jpeg;base64,/9j/4AAQ..."}
asyncStringify(value, replacer, space?)Converts a JavaScript value to a JSON string with support for async replacer functions.
value (any): A JavaScript value, usually an object or array, to be converted.
replacer ((this: any, key: string, value: any) => Promise<any>): An async function that transforms values before serialization. The function receives:
key: The property key (empty string for the root value)value: The property valuethis: The parent object containing the valueThe function should return a Promise that resolves to the transformed value.
space (number | string, optional): Adds indentation, white space, and line break characters to make the output more readable:
Promise<string>: A Promise that resolves to the JSON string representation of the value.
TypeError: If a circular reference is detected in the object structureTypeError: If a BigInt value is encountered (BigInt values cannot be serialized to JSON)FAQs
JSON stringify with support for an async replacer function
The npm package @cameronhunter/json-async-stringify receives a total of 0 weekly downloads. As such, @cameronhunter/json-async-stringify popularity was classified as not popular.
We found that @cameronhunter/json-async-stringify 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.

Research
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.

Research
/Security News
A malicious Chrome extension steals newly created MEXC API keys, exfiltrates them to Telegram, and enables full account takeover with trading and withdrawal rights.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.