Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
ndjson-readablestream
Advanced tools
A small JS package for reading a ReadableStream of NDJSON.
readNDJSONStream()
accepts a ReadableStream object,
and returns an AsyncGenerator where each yielded event is a valid JSON object.
Example usage:
import readNDJSONStream from 'ndjson-readablestream';
const response = await fetch('/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: 'Hi, how are you?' }),
});
for await (const event of readNDJSONStream(response.body)) {
console.log('Received', event);
}
Example usage in a webpage:
<script src="https://cdn.jsdelivr.net/npm/ndjson-readablestream@1.0.1/dist/ndjson-readablestream.umd.js"></script>
<script>
const response = await fetch("/chat", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({message: "Hi, how are you?"})
});
for await (const event of readNDJSONStream(response.body)) {
console.log("Received", event);
}
</script>
For more details and examples, read my blog post on Fetching JSON over streaming HTTP.
Install the development dependencies:
npm install
Run the tests:
npm test
Format the code:
npm run format
These instructions are for maintainers only.
npm version patch
npm version minor
npm version major
npm install
to update package-lock.jsonnpm run build
npm login
npm publish
FAQs
A small JS package for reading a ReadableStream of NDJSON
The npm package ndjson-readablestream receives a total of 34,165 weekly downloads. As such, ndjson-readablestream popularity was classified as popular.
We found that ndjson-readablestream 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
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.