This library contains utilities and Node.js gRPC bindings for use with [ddrpd](https://github.com/ddrp-org/ddrpd) nodes.
Last updated 3 months ago by mslipper-kyokan .
ISC · Original npm · Tarball · package.json
$ cnpm install ddrp-js 
SYNC missed versions from official npm registry.


This library contains utilities and Node.js gRPC bindings for use with ddrpd nodes.


The below usage information is a high-level overview of the library. More in-depth documentation can be found by viewing the TSDoc. The TSDoc can be generating by running npm run docs.


To use the gRPC API, you'll need to instantiate DDRPDClient like this:

// replace with your node's URL,
// if other than the default:
const client = new DDRPDClient('');

Once done, you can call any of the service mthods defined on DDRPDClient.

Reading Social Data

ddrp-js includes support for reading and writing social data to DDRP blobs. To read social data out of a blob, we recommend using the iterateAllEnvelopes method like this:

const blobName = 'foobar';
const client = new DDRPDClient('');

// creates an instance of a buffered Readable, which will read
// from the blob using gRPC and keep the data in a 1MB buffer.
const reader = new BufferedReader(new Blobreader(blobName, client), 1024 * 1024);
iterateAllEnvelopes(reader, (err, envelope) => {
	if (err) {
		return false;
	if (envelope === null) {
		return false;
	// do something with the envelope
	return true;

Writing Social Data

Writing social data to a blob is a similar process to reading, however doing so requires the private key of the blob being written to:

const blobName = 'foobar';
const client = new DDRPDClient('');
// replace the below with your actual private key
const signer = SECP256k1Signer.fromHexPrivateKey('cafecafe12345');
const truncate = false;
const writer = new EnvelopeWriter(client, blobName, truncate, signer);
await writer.open();
// see TSDoc for docs on creating Envelopes
const envelope = new Envelope(...);
await writer.writeEnvelope(envelope);
await writer.commit();

Note that this will start writing from the beginning of the blob. ddrp-js does not keep track of last-used offsets within a blob; this is left up to applications.

A Note on Streams

ddrp-js uses its own internal streaming implementation. Classes that make use of streaming IO generally implement the Reader or Writer interfaces. Helper methods are provided that abstract this detail away, however more advanced use cases may need to make use of the streaming libraries directly.

Current Tags

  • 3.0.3                                ...           latest (a month ago)

12 Versions

  • 3.0.3                                ...           a month ago
  • 3.0.2                                ...           a month ago
  • 3.0.0                                ...           2 months ago
  • 2.1.1                                ...           2 months ago
  • 2.1.0                                ...           2 months ago
  • 2.0.0                                ...           2 months ago
  • 1.0.0                                ...           2 months ago
  • 0.0.5                                ...           3 months ago
  • 0.0.4                                ...           3 months ago
  • 0.0.3                                ...           3 months ago
  • 0.0.2                                ...           3 months ago
  • 0.0.1                                ...           3 months ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 22
Dependencies (15)
Dev Dependencies (3)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |