
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
adhoc-stream
Advanced tools
Hmm. This stream is outputting a bunch of objects, but I really only need one of their attributes. Wouldn't it be handy if I could just do that inline...?
Yes, yes it would.
adhoc-stream
is a set of utility functions for creating inline, one-off streams, without having to extend a stream
object.
someModule = require "some-module"
JSONStream = require "JSONStream"
adhocStream = require "adhoc-stream"
fs.createReadStream "./path/to/some/file"
.pipe someModule.parseThings()
.pipe adhocStream.transformSync {objectMode: true}, (obj, encoding) ->
@push obj.someAttribute
.pipe JSONStream.stringify(false)
.pipe process.stdout
Instantiates a Readable
stream.
options
parameter for new stream.Readable
._read
. Same function signature as for new stream.Readable
.Alias for .readable
. Does nothing special, because Readable
streams don't need a callback in their _read
method.
Instantiates a Writable
stream.
options
parameter for new stream.Writable
._write
. Same function signature as for new stream.Writable
.Same as .writable
, but automatically calls the callback
after executing func
. Useful for one-liners in CoffeeScript. Only usable when your func
is completely synchronous.
Instantiates a Transform
stream.
options
parameter for new stream.Transform
._transofmr
. Same function signature as for new stream.Transform
.Same as .transform
, but automatically calls the callback
after executing func
. Useful for one-liners in CoffeeScript. Only usable when your func
is completely synchronous.
Example:
fs.createReadStream "./path/to/some/file"
.pipe adhocStream.transformSync {}, (chunk) -> @push doSomething(chunk)
...
Instantiates a Duplex
stream.
options
parameter for new stream.Duplex
._read
. Same function signature as for new stream.Duplex
._write
. Same function signature as for new stream.Duplex
.Same as .duplex
, but automatically calls the callback
after executing writeFunc
(readFunc
is unaffected). Useful for one-liners in CoffeeScript. Only usable when your writeFunc
is completely synchronous.
FAQs
An easy way to create inline, one-off streams.
The npm package adhoc-stream receives a total of 0 weekly downloads. As such, adhoc-stream popularity was classified as not popular.
We found that adhoc-stream demonstrated a not healthy version release cadence and project activity because the last version was released 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
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.