View Issue Details

IDProjectCategoryView StatusLast Update
0000096fileGeneralpublic2019-08-05 13:10
Reporterkoala_man Assigned Tochristos  
Status resolvedResolutionfixed 
Product Version5.37 
Fixed in Version5.38 
Summary0000096: Add support for Hermes compiled JavaScript bytecode
DescriptionHi! I am one of the developers of Hermes, a new JavaScript engine for mobile that pre-compiles JavaScript into bytecode. For your consideration, here is magic that can recognize our bytecode files (64bit magic + 32bit integer version, little-endian):

    0 lequad 0x1F1903C103BC1FC6 Hermes compiled JavaScript bytecode,
    >8 lelong x version %d

I think there is a case for upstreaming this because: 1. the use of a 64bit magic number minimizes the risk of false positives, 2. it's convenient for mobile JS to be able to determine a file's bytecode version to check compatibility, and 3. there are already hundreds of millions of mobile devices carrying files in this format.

Please let me know what you think.
Steps To ReproduceI have attached `hello.hbc`, a simple `print("Hello World");` compiled into Hermes bytecode using `hermes -O -emit-binary -out hello.hbc hello.js`

Without the suggested magic, file's guess is `data`. With the magic, it says:

    hello.hbc: Hermes compiled JavaScript bytecode, version 60
Additional InformationHermes is developed by Facebook and was open sourced in July 2019:

The bytecode header and magic numbers can be found in:



2019-08-02 20:34


hello.hbc (284 bytes)


2019-08-05 13:10

manager   ~0003282

Fixed, thanks!

Issue History

Date Modified Username Field Change
2019-08-02 20:34 koala_man New Issue
2019-08-02 20:34 koala_man File Added: hello.hbc
2019-08-02 20:34 koala_man Tag Attached: magic
2019-08-05 13:09 christos Assigned To => christos
2019-08-05 13:09 christos Status new => assigned
2019-08-05 13:10 christos Status assigned => resolved
2019-08-05 13:10 christos Resolution open => fixed
2019-08-05 13:10 christos Fixed in Version => 5.38
2019-08-05 13:10 christos Note Added: 0003282