| CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Tue, 23 Dec 2025 13:26:46 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20091025072839
location: https://web.archive.org/web/20091025072839/https://github.com/rklophaus/BERT-JS
server-timing: captures_list;dur=0.866700, exclusion.robots;dur=0.088528, exclusion.robots.policy;dur=0.073124, esindex;dur=0.012137, cdx.remote;dur=12.270002, LoadShardBlock;dur=283.342558, PetaboxLoader3.datanode;dur=194.442274, PetaboxLoader3.resolve;dur=57.761995
x-app-server: wwwb-app204-dc6
x-ts: 302
x-tr: 326
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
set-cookie: wb-p-SERVER=wwwb-app204; path=/
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Tue, 23 Dec 2025 13:26:46 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.61
x-archive-orig-date: Sun, 25 Oct 2009 07:28:38 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "552d076ad17659946661794c2b5bc229"
x-archive-orig-x-runtime: 133ms
x-archive-orig-content-length: 24243
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sun, 25 Oct 2009 07:28:39 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_12_20091025051417_crawl103_IndexOnly-c/52_12_20091025072617_crawl101.arc.gz
server-timing: captures_list;dur=0.483896, exclusion.robots;dur=0.018829, exclusion.robots.policy;dur=0.008840, esindex;dur=0.009378, cdx.remote;dur=17.519293, LoadShardBlock;dur=119.303018, PetaboxLoader3.datanode;dur=144.520361, PetaboxLoader3.resolve;dur=63.693756, load_resource;dur=116.205906
x-app-server: wwwb-app204-dc6
x-ts: 200
x-tr: 317
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
rklophaus's BERT-JS at master - GitHub
This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| Description: | Javascript implementation of BERT serialization (Binary ERlang Term). edit |
| Homepage: | edit |
| Public Clone URL: |
git://github.com/rklophaus/BERT-JS.git
Give this clone URL to anyone.
git clone git://github.com/rklophaus/BERT-JS.git
|
| Your Clone URL: |
Use this clone URL yourself.
git clone git@github.com:rklophaus/BERT-JS.git
|
BERT-JS /
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Tue Sep 29 18:43:14 -0700 2009 | Add license info. [rklophaus] |
| |
README.markdown | Wed Sep 30 05:29:02 -0700 2009 | README edits. [rklophaus] |
| |
bert.js | Thu Oct 01 05:02:51 -0700 2009 | Merge bbrowning's changes. Add test cases for d... [rklophaus] |
README.markdown
BERT-JS
What is BERT?
BERT (Binary ERlang Term) is a format created by the Erlang development team for serializing Erlang terms, and promoted by Tom Preston-Werner as a way for different languages to communicate in a simple and efficient manner.
What is BERT JS?
BERT-JS is a first cut Javascript implementation of the BERT protocol. In other words, using BERT-JS, you can serialize data into a binary format that can then be de-serialized by Erlang directly into an Erlang term. (Or, by Ruby, as Tom has written a BERT library for Ruby.)
Limitations
- Decoding floats is not yet supported.
Interface
- Bert.encode(Object) - Encode a Javascript object into BERT, return a String. The object can be a Boolean, Integer, Float, String, Array, Associative Array, or an Atom, Binary, or Tuple. (with the help of Bert.atom(), Bert.binary(), or Bert.tuple(), respectively).
- Bert.decode(String) - Decode a BERT string into a Javascript object. Atoms, Binaries, and Tuples are special objects. See code for structure.
- Bert.atom(String) - Create a Javascript object that will be encoded to an Atom.
- Bert.binary(String) - Create a Javascript object that will be encoded to an Binary.
- Bert.tuple(Element1, Element2, Element3, ...) - Create a Javascript object that will be encoded to a Tuple.
Examples
Note, below the return value is given in the form of an Erlang binary which can be fed into Erlang's binary_to_term/1. In reality, this returns a Javascript String with the ASCII values of the binary.
Bert.encode(Bert.atom("hello"));
Returns: <<131,100,0,5,104,101,108,108,111>>
Erlang: hello
Bert.encode(Bert.binary("hello"));
Returns: <<131,109,0,0,0,5,104,101,108,108,111>>
Erlang: <<"hello">>
Bert.encode(true);
Returns: <<131,100,0,4,116,114,117,101>>
Erlang: true
Bert.encode(42);
Returns: <<131,97,42>>
Erlang: 42
Bert.encode(5000);
Returns: <<131,98,0,0,19,136>>
Erlang: 5000
Bert.encode(-5000);
Returns: <<131,98,255,255,236,120>>
Erlang: -5000
Bert.encode(987654321);
Returns: <<131,110,4,0,177,104,222,58>>
Erlang: 987654321
Bert.encode(-987654321);
Returns: <<131,110,4,1,177,104,222,58>>
Erlang: -987654321
Bert.encode(3.14159);
Returns: <<131,99,51,46,49,52,49,53,57,101,43,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>
Erlang: 3.14159
Bert.encode(-3.14159);
Returns: <<131,99,45,51,46,49,52,49,53,57,101,43,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>
Erlang: -3.14159
Bert.encode([1, 2, 3]);
Returns: <<131,108,0,0,0,3,97,1,97,2,97,3,106>>
Erlang: [1,2,3]
Bert.encode({a:1, b:2, c:3});
Returns: <<131,108,0,0,0,3,104,2,100,0,1,97,97,1,104,2,100,0,1,98,97,2,104,2,100,0,1,99,97,3,106>>
Erlang: [{a,1},{b,2},{c,3}]
Bert.encode(Bert.tuple("Hello", 1));
Returns: <<131,104,2,107,0,5,72,101,108,108,111,97,1>>
Erlang: {"Hello",1}
Bert.encode({
a : Bert.tuple(1, 2, 3),
b : [4,5,6]
});
Returns: <<131,108,0,0,0,2,104,2,100,0,1,97,104,3,97,1,97,2,97,3,104,2,100,0,1,98,108,0,0,0,3,97,4,97,5,97,6,106,106>>
Erlang: [{a,{1,2,3}},{b,[4,5,6]}]
var S = Bert.bytes_to_string([131,108,0,0,0,3,104,2,100,0,4,97,116,111,109,100,0,6,109,121,65,116,111,109,
104,2,100,0,6,98,105,110,97,114,121,109,0,0,0,9,77,121,32,66,105,110,97,114,
121,104,2,100,0,4,98,111,111,108,100,0,4,116,114,117,101,106]);
var Obj = Bert.decode(S);
Object is equiv to: [{atom,myAtom},{binary,<<"My Binary">>},{bool,true},{string,"Hello there"}]
var S = Bert.bytes_to_string([131,108,0,0,0,5,104,2,100,0,13,115,109,97,108,108,95,105,110,116,101,103,101,
114,97,42,104,2,100,0,8,105,110,116,101,103,101,114,49,98,0,0,19,136,104,2, 100,0,8,105,110,116,101,103,
101,114,50,98,255,255,236,120,104,2,100,0,8,98,105,103,95,105,110,116,49,110,4,0,177,104,222,58,104,2,
100,0,8,98,105,103,95,105,110,116,50,110,4,1,177,104,222,58,106]);
var Obj = Bert.decode(S);
Object is equiv to: [{small_integer,42},{integer1,5000},{integer2,-5000},{big_int1,987654321},{big_int2,-987654321}]
This feature is coming soon. Sit tight!







