Ejscript FAQ

Questions

How do I print to the console?

How do I read from a file?

How can I trouble-shoot with trace?

Licensing Questions

Do I need to share my enhancements?

Will my patches make it into the Open Source version?

I'm using Ejscript stand-alone, can I use the GPL?

Can I distribute my product under the GPL license?

Can I prototype using the GPL license?

When do I need to take out a commercial license?

Can I link in non-GPL code?

Answers

How to print to the console?

Use the print global function:

home> ejs
print("Hello World")
Hello World

How to read from a file?

There are several ways to read from a file. To read the entire file into a string:

str = File.getString("file.txt")

To read a file line-by-line:

lines = File.getLines("file.txt")
for each (l in lines) {
    print(l)
}

How can I trouble-shoot with trace?

Run ejscript with the logging switch "--log". The logging switch takes the following parameters:

ejs --log logName[:logLevel]

Where logLevel is a number between 0 and 9. Zero is the least verbose.

In the default binary distribution or if ejs is built in debug mode, level 2 will trace each source code and assembler instruction as it is executed.

Do I need to share my enhancements?

If you are using the GPL license, you must make your enhancements available to all under the terms of the GPL License. If you are using a commercial license, you may keep your modifications private. You are however, very welcome to share your enhancements with us for inclusion in future releases.

Will my patches make it into the Open Source version?

The contributors agreement ensures that if your patches are included in the commercial version of Ejscript, they will always be included in the open source version. All patches are examined for suitability and sometimes several individuals submit similar patches. As such, we cannot guarantee that your code will be included in the product.

I'm using Ejscript as a stand-alone program can I use the GPL?

Probably Yes. If you distribute your application and you choose the GPL license, then you must also make your source code that is linked with an of the Ejscript programs, available to others. If you do not link (using either dynamic or static linking) with Ejscript, you may not need to share your code. Read the GPL License for full details. If you want to keep your source code private, Embedthis provides commercial licenses for that purpose.

Can I distribute my product that includes Ejscript under the GPL license?

Yes. You just need to make your source code that links with Ejscript available to all.

Can I prototype using the GPL license?

Yes. You can prototype and develop internally using the GPL license. If you distribute your product, you must either provide source code to all, or you will need a commercial license.

When do I need to take out a commercial license?

If you want to keep your source code private or if you want support and a commercial warranty, then a commercial license is probably necessary.

Can I link in non-GPL code?

If you are using the GPL license, you can link in code that has a GPL-compatible license. If you are using the commercial license, you can link in any non-GPL code.

© Embedthis Software, 2003-2015. All rights reserved.