mtth / Avsc
Licence: mit
Avro for JavaScript ⚡️
Stars: ✭ 930
Programming Languages
javascript
184084 projects - #8 most used programming language
typescript
32286 projects
Labels
Projects that are alternatives of or similar to Avsc
Avro4k
Avro support for kotlinx.serialization
Stars: ✭ 82 (-91.18%)
Mutual labels: serialization, avro
Avro4s
Avro schema generation and serialization / deserialization for Scala
Stars: ✭ 593 (-36.24%)
Mutual labels: serialization, avro
avro-serde-php
Avro Serialisation/Deserialisation (SerDe) library for PHP 7.3+ & 8.0 with a Symfony Serializer integration
Stars: ✭ 43 (-95.38%)
Mutual labels: serialization, avro
kafka-serialization
Lego bricks to build Apache Kafka serializers and deserializers
Stars: ✭ 122 (-86.88%)
Mutual labels: serialization, avro
avrow
Avrow is a pure Rust implementation of the avro specification https://avro.apache.org/docs/current/spec.html with Serde support.
Stars: ✭ 27 (-97.1%)
Mutual labels: serialization, avro
Noproto
Flexible, Fast & Compact Serialization with RPC
Stars: ✭ 138 (-85.16%)
Mutual labels: serialization, avro
javascript-serialization-benchmark
Comparison and benchmark of JavaScript serialization libraries (Protocol Buffer, Avro, BSON, etc.)
Stars: ✭ 54 (-94.19%)
Mutual labels: serialization, avro
Cpp Serializers
Benchmark comparing various data serialization libraries (thrift, protobuf etc.) for C++
Stars: ✭ 533 (-42.69%)
Mutual labels: serialization, avro
Bridge Deprecated
[DEPRECATED]: Prefer Retrofit/OkHttp by Square, or Fuel for Kotlin
Stars: ✭ 624 (-32.9%)
Mutual labels: serialization
Kafka Storm Starter
Code examples that show to integrate Apache Kafka 0.8+ with Apache Storm 0.9+ and Apache Spark Streaming 1.1+, while using Apache Avro as the data serialization format.
Stars: ✭ 728 (-21.72%)
Mutual labels: avro
Iod
Meta programming utilities for C++14. Merged in matt-42/lithium
Stars: ✭ 731 (-21.4%)
Mutual labels: serialization
Pbf
A low-level, lightweight protocol buffers implementation in JavaScript.
Stars: ✭ 618 (-33.55%)
Mutual labels: serialization
Msgpack Rust
MessagePack implementation for Rust / msgpack.org[Rust]
Stars: ✭ 561 (-39.68%)
Mutual labels: serialization
Protobuf Convert
Macros for convenient serialization of Rust data structures into/from Protocol Buffers 3
Stars: ✭ 22 (-97.63%)
Mutual labels: serialization
Jackson Module Kotlin
Module that adds support for serialization/deserialization of Kotlin (http://kotlinlang.org) classes and data classes.
Stars: ✭ 830 (-10.75%)
Mutual labels: serialization
Go Capnproto2
Cap'n Proto library and code generator for Go
Stars: ✭ 682 (-26.67%)
Mutual labels: serialization
Avsc
Pure JavaScript implementation of the Avro specification.
Features
- Blazingly fast and compact serialization! Typically faster than JSON with much smaller encodings.
- All the Avro goodness and more: type inference, schema evolution, and remote procedure calls.
- Support for serializing arbitrary JavaScript objects.
- Unopinionated 64-bit integer compatibility.
Installation
$ npm install avsc
avsc
is compatible with all versions of node.js since 0.11
and major
browsers via browserify. For convenience, you can also find compiled
distributions with the releases (but please host your own copy).
Documentation
Examples
Inside a node.js module, or using browserify:
const avro = require('avsc');
-
Encode and decode values from a known schema:
const type = avro.Type.forSchema({ type: 'record', fields: [ {name: 'kind', type: {type: 'enum', symbols: ['CAT', 'DOG']}}, {name: 'name', type: 'string'} ] }); const buf = type.toBuffer({kind: 'CAT', name: 'Albert'}); // Encoded buffer. const val = type.fromBuffer(buf); // = {kind: 'CAT', name: 'Albert'}
-
Infer a value's schema and encode similar values:
const type = avro.Type.forValue({ city: 'Cambridge', zipCodes: ['02138', '02139'], visits: 2 }); // We can use `type` to encode any values with the same structure: const bufs = [ type.toBuffer({city: 'Seattle', zipCodes: ['98101'], visits: 3}), type.toBuffer({city: 'NYC', zipCodes: [], visits: 0}) ];
-
Get a readable stream of decoded values from an Avro container file compressed using Snappy (see the
BlockDecoder
API for an example including checksum validation):const snappy = require('snappy'); // Or your favorite Snappy library. const codecs = { snappy: function (buf, cb) { // Avro appends checksums to compressed blocks, which we skip here. return snappy.uncompress(buf.slice(0, buf.length - 4), cb); } }; avro.createFileDecoder('./values.avro', {codecs}) .on('metadata', function (type) { /* `type` is the writer's type. */ }) .on('data', function (val) { /* Do something with the decoded value. */ });
-
Implement a TCP server for an IDL-defined protocol:
// We first generate a protocol from its IDL specification. const protocol = avro.readProtocol(` protocol LengthService { /** Endpoint which returns the length of the input string. */ int stringLength(string str); } `); // We then create a corresponding server, implementing our endpoint. const server = avro.Service.forProtocol(protocol) .createServer() .onStringLength(function (str, cb) { cb(null, str.length); }); // Finally, we use our server to respond to incoming TCP connections! require('net').createServer() .on('connection', (con) => { server.createChannel(con); }) .listen(24950);
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].