
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
streaming-json-stringify
Advanced tools
Similar to JSONStream.stringify() except it is, by default, a binary stream, and it is a streams2 implementation.
The main use case for this is to stream a database query to a web client. This is meant to be used only with arrays, not objects.
var Stringify = require('streaming-json-stringify')
app.get('/things', function (req, res, next) {
res.setHeader('Content-Type', 'application/json; charset=utf-8')
db.things.find()
.stream()
.pipe(Stringify())
.pipe(res)
})
will yield something like
[
{"_id":"123412341234123412341234"}
,
{"_id":"123412341234123412341234"}
]
'[\n'.'\n,\n'.'\n]\n'.Returns a Transform stream.
The options are passed to the Transform constructor.
You can override these:
var stringify = Stringify()
stringify.replacer = function () {}
stringify.space = 2
JSONStream is another package that allows for streaming JSON parsing and stringifying. It is highly flexible and can handle large JSON datasets efficiently. Compared to 'streaming-json-stringify', JSONStream offers more granular control over the JSON parsing and stringifying process, but it may be more complex to use for simple tasks.
The 'ndjson' package is designed for newline-delimited JSON streaming. It is particularly useful for processing large datasets where each JSON object is separated by a newline. While 'ndjson' is excellent for line-by-line JSON processing, 'streaming-json-stringify' is more suited for converting entire objects or arrays into JSON strings.
Oboe.js is a library for loading JSON objects incrementally from a stream. It allows for real-time processing of JSON data as it is received. Compared to 'streaming-json-stringify', Oboe.js is more focused on parsing and handling incoming JSON data streams rather than stringifying outgoing data.
FAQs
Streaming JSON.stringify()
The npm package streaming-json-stringify receives a total of 187,351 weekly downloads. As such, streaming-json-stringify popularity was classified as popular.
We found that streaming-json-stringify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.