Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

thrift-dev

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thrift-dev

node.js bindings for the Apache Thrift RPC system

  • 0.8.0-dev02
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

node-thrift

Thrift protocol implementation for nodejs. As of version 0.0.1, the basic protocol has been implemented. A Thrift compiler that will generate the .js files from a Thrift specification is being implemented as well, see the Thrift Compiler section below.

NOTE: By default, node-thrift uses TFramedTransport. Using a popular example, this is enabled by default in Cassandra 0.7 (but configuration must be changed in Cassandra 0.6.x and earlier). See the examples folder to see how to enable TBufferedTransport (added in 0.7.0).

Install

npm install thrift 

Thrift Compiler

A Thrift compiler is included in the 0.6.0 release of Thrift. You can compile nodejs sources by running the following:

thrift --gen js:node thrift_file

Cassandra Client Example:

Here is a Cassandra example:

var thrift = require('thrift'),
    Cassandra = require('./gen-nodejs/Cassandra')
    ttypes = require('./gen-nodejs/cassandra_types');

var connection = thrift.createConnection("localhost", 9160),
    client = thrift.createClient(Cassandra, connection);

connection.on('error', function(err) {
  console.error(err);
});

client.get_slice("Keyspace", "key", new ttypes.ColumnParent({column_family: "ExampleCF"}), new ttypes.SlicePredicate({slice_range: new ttypes.SliceRange({start: '', finish: ''})}), ttypes.ConsistencyLevel.ONE, function(err, data) {
  if (err) {
    // handle err
  } else {
    // data == [ttypes.ColumnOrSuperColumn, ...]
  }
  connection.end();
});

Int64

Since JavaScript represents all numbers as doubles, int64 values cannot be accurately represented naturally. To solve this, int64 values in responses will be wrapped with Thirft.Int64 objects. The Int64 implementation used is broofa/node-int64.

Libraries using node-thrift

Custom client and server example

An example based on the one shown on the Thrift front page is included in the examples folder.

FAQs

Package last updated on 06 Oct 2011

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc