
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Lightweight Aria2 JSON-RPC client with full type definition.
async-call-rpc
to implement the JSON-RPC client.fetch
, not node-fetch
, isomorphic-fetch
or other...A2C requires async-call-rpc
, so you should install them both.
pnpm add a2c async-call-rpc # pnpm
# yarn add a2c async-call-rpc # yarn
# npm i a2c async-call-rpc # npm
import { createClient } from 'a2c'
// import { notify, batch } from 'async-call-rpc'
const aria2 = createClient({
url: 'http://localhost:6800/jsonrpc', // defaultValue
secret: '123e4567-e89b-12d3-a456-426614174000', // --rpc-secret, optional
})
await aria2.getVersion().then(console.log) // { enabledFeatures: [], version: '1.36.0' }
// const notify = notify(createClient())
// const [batch, emit, drop] = batch(createClient())
If you use user/passwd instead of secret:
import { createClient } from 'a2c'
const aria2 = createClient({
url: 'http://localhost:6800/jsonrpc', // defaultValue
user: 'username', // --rpc-user
secret: 'password', // --rpc-passwd
})
createClient
is a wrapper around AsyncCall
. So of course you can use it directly if you want:
import { A2Channel, type Aria2 } from 'a2c'
import { AsyncCall } from 'async-call-rpc'
const aria2 = AsyncCall<Aria2>(
{},
{
channel: new A2Channel({
url: 'http://localhost:6800/jsonrpc', // defaultValue
secret: '', // --rpc-secret, optional
}),
}
)
A2Channel uses the fetch
in the runtime environment.
But for some custom use cases, you can also implement your own EventBasedChannel and reuse the A2C type definition:
import type { Aria2 } from 'a2c'
import { type EventBasedChannel, AsyncCall } from 'async-call-rpc'
class MyChannel implements EventBasedChannel {
on(listener: (data: unknown) => void) {
...
}
send(data: unknown): void {
...
}
}
const aria2 = AsyncCall<Aria2>(
{},
{ channel: new MyChannel() }
)
FAQs
Lightweight Aria2 JSON-RPC client with full type definition.
We found that a2c 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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.