Thrift Core
Base package for the other Thrift libraries. This will usually not be used directly. Usually consumers will get everything they need from the consuming libraries:
Usage
$ npm install --save @creditkarma/thrift-server-core
Int64
For representing 64-bit integers in JavaScript we use the node-int64 library. We extend the base class from the library with static methods for working with 64-bit integers written as strings. These functions are largely taken from the apache thrift libs and added as static methods for convinience.
fromDecimalString
Given a string of decimal digits, return a Int64
object instance.
import { Int64 } from '@creditkarma/thrift-server-core'
const i64: Int64 = Int64.fromDecimalString("89374875")
toDecimalString
import { Int64 } from '@creditkarma/thrift-server-core'
const i64: Int64 = Int64.fromDecimalString("89374875")
const val: string = i64.toDecimalString()
// val === "89374875"
toDecimalString
static
For consistency the toDecimalString
method is also available statically on the Int64
class. The static method can take a number
or Int64
instance.
import { Int64 } from '@creditkarma/thrift-server-core'
const i64: Int64 = new Int64(64)
const val: string = Int64.toDecimalString(i64)
// val === "64"
Roadmap
- Support CompactProtocol, JsonProtocol and FramedTransport
Contributing
For more information about contributing new features and bug fixes, see our Contribution Guidelines. External contributors must sign Contributor License Agreement (CLA)
License
This project is licensed under Apache License Version 2.0