Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@f0rr0/thrift-compact-protocol
Advanced tools
Marshalling/unmarshalling between Facebook Thrift Compact Protocol and Javascript with type definitions.
Marshalling/unmarshalling between Facebook Thrift Compact Protocol and Javascript with type definitions.
import {
t,
ThriftType,
thriftReadToObject,
thriftWriteFromObject,
} from '@f0rr0/thrift-compact-protocol'
// Describe the shape of expected Thrift data over the wire
const structDefinition = t.struct({
foo: t.field(1, t.boolean()),
bar: t.field(2, t.int64()).optional(),
baz: t.field(
4,
t.list(
t.struct({
quz: t.field(1, t.binary()),
})
)
),
})
// Typescript type is inferred from the Thrift definition
type StructDefinition = t.TypeOf<typeof structDefinition>
// Parse a Thrift buffer to JS object
const javascriptObject = thriftReadToObject(
someThriftBufferPayload,
structDefinition
)
// Write JS object to Thrift buffer
const thriftBuffer = thriftWriteFromObject(
{
foo: true,
bar: BigInt(1),
baz: [
{
quz: 'string',
},
],
},
structDefinition
)
FAQs
Marshalling/unmarshalling between Facebook Thrift Compact Protocol and Javascript with type definitions.
We found that @f0rr0/thrift-compact-protocol 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.