Avro 1.8.2 (JS)

Source: Internet
Author: User

The Avro 1.8.2, released on May 15, already contains the JS version of the code.

Tsinghua University Mirror Address:

https://mirrors.tuna.tsinghua.edu.cn/apache/avro/avro-1.8.2/js/

According to README.MD, run a simple example.

Specific steps:

1. Unzip the downloaded compressed package

2. Under the package directory, create a simple file index.js with the following content:

var Avro = require ("./lib/index");


var type = Avro.parse ({
Name: ' Pet ',
Type: ' Record ',
Fields: [
{name: ' Kind ', type: {name: ' Kind ', type: ' enum ', symbols: [' CAT ', ' DOG '}},
{name: ' name ', type: ' String '}
]
});
var pet = {kind: ' CAT ', Name: ' Albert '};
var buf = Type.tobuffer (PET); Serialized object.
var obj = Type.frombuffer (BUF); {kind: ' CAT ', Name: ' Albert '}
Console.log (obj)
Console.log (PET)
Console.log (Obj==pet)

3. Open the command line, switch to the package directory, and execute node index.js

If there is no NODEJS environment, you need to go to Nodejs official website to download the installation, install and run node Index.js may be prompted underscore can not find,

Execute node install underscore at the command line.

Avro 1.8.2 (JS)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.