
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.
jsonarrayfs
Advanced tools
Specialized Node.js library for memory-efficient operations on JSON arrays. Stream individual elements from large JSON arrays (files, network responses etc.) and append elements to array files without loading the entire array into memory. Perfect for proc
Specialized Node.js library for memory-efficient operations on JSON arrays. Stream individual elements from large JSON arrays (files, network responses etc.) and append elements to array files without loading the entire array into memory. Perfect for processing large-scale JSON array datasets without memory limitations.
npm install jsonarrayfs
Processs a large JSON array file (e.g., application logs) without loading it into memory:
import { JsonArrayStream } from "jsonarrayfs";
import { createReadStream } from "node:fs";
// Analyze logs: Count errors and slow responses
const fileStream = createReadStream("app.log.json");
const arrayStream = new JsonArrayStream("utf8");
let errorCount = 0;
let slowResponses = 0;
for await (const log of fileStream.pipe(arrayStream)) {
if (log !== JsonArrayStream.NULL) {
if (log.level === "error") errorCount++;
if (log.responseTime > 1000) slowResponses++;
}
}
console.log(
`Analysis complete: Found ${errorCount} errors, ${slowResponses} slow responses`,
);
Process a JSON array from an API response:
import { JsonArrayStream } from "jsonarrayfs";
import { get } from "node:https";
get("https://api.example.com/json-array-data", (res) => {
const arrayStream = new JsonArrayStream("utf8");
res.pipe(arrayStream).on("data", (item) => {
console.log(`Got item: ${item === JsonArrayStream.NULL ? null : item}`);
});
});
Append new elements to an existing JSON array file:
import { JsonArrayStream, appendToJsonArrayFile } from "jsonarrayfs";
// Append new log entries
const newLogs = [
{
timestamp: Date.now(),
level: "info",
message: "User login successful",
responseTime: 245,
},
{
timestamp: Date.now(),
level: "info",
message: "User login successful",
responseTime: 1245,
},
null,
{
timestamp: Date.now(),
level: "error",
message: "Database connection timeout",
responseTime: 1532,
},
];
await appendToJsonArrayFile("app.log.json", "utf8", ...newLogs);
JsonArrayStreamA transform stream that parses JSON array elements one by one for efficient processing. When processing arrays containing null values, it uses a special sentinel value (JsonArrayStream.NULL) to distinguish between JSON null and stream EOF.
new JsonArrayStream(encoding?: string)
encoding (string, optional): Content encoding (default: 'utf8')JsonArrayStream.NULL: Special sentinel value to distinguish between JSON null and stream EOFdata: Emitted for each array elementerror: Emitted when parsing fails or input is invalidappendToJsonArrayFileAppends elements to a JSON array file efficiently without loading the entire file into memory.
async function appendToJsonArrayFile(
filePath: string,
encoding?: string,
...elements: any[]
): Promise<void>;
filePath (string): Path to the JSON array fileencoding (string, optional): File encoding (default: 'utf8')...elements (any[]): Elements to append to the arrayPromise that resolves when the append operation is complete.
The library can throw these errors:
JsonArrayStreamErrorJsonArrayAppendErrorMIT License - see the LICENSE file for details
FAQs
Specialized Node.js library for memory-efficient operations on JSON arrays. Stream individual elements from large JSON arrays (files, network responses etc.) and append elements to array files without loading the entire array into memory. Perfect for proc
We found that jsonarrayfs 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.