diff --git a/docz/docs/02-getting-started/01-installation/04-amd.md b/docz/docs/02-getting-started/01-installation/04-amd.md index 2ff3d3e..bd5e123 100644 --- a/docz/docs/02-getting-started/01-installation/04-amd.md +++ b/docz/docs/02-getting-started/01-installation/04-amd.md @@ -21,8 +21,8 @@ Each standalone release script is available at . When referencing by file name, AMD loaders typically omit the file extension. -The actual file name is `xlsx.full.min.js`, but the examples will refer to the -script as `xlsx.full.min`. +The actual file name is `xlsx.full.min.js`, but the examples identify the script +using the name `xlsx.full.min` ::: diff --git a/docz/docs/03-demos/07-data/19-alasql.md b/docz/docs/03-demos/07-data/19-alasql.md index 046185e..e138f1b 100644 --- a/docz/docs/03-demos/07-data/19-alasql.md +++ b/docz/docs/03-demos/07-data/19-alasql.md @@ -29,7 +29,7 @@ This demo was tested in the following environments: | Environment | AlaSQL | Date | |:--------------------|:-------|:----------:| -| NodeJS | 3.1.0 | 2023-07-24 | +| NodeJS | 3.1.0 | 2023-10-26 | | Standalone (Chrome) | 3.0.0 | 2023-08-20 | ::: diff --git a/docz/docs/03-demos/42-engines/01-duktape.md b/docz/docs/03-demos/42-engines/01-duktape.md index cd83bf6..a65cf50 100644 --- a/docz/docs/03-demos/42-engines/01-duktape.md +++ b/docz/docs/03-demos/42-engines/01-duktape.md @@ -119,7 +119,7 @@ This demo was tested in the following deployments: | Architecture | Version | Date | |:-------------|:--------|:-----------| -| `darwin-x64` | `2.7.0` | 2023-07-24 | +| `darwin-x64` | `2.7.0` | 2023-10-26 | | `darwin-arm` | `2.7.0` | 2023-10-18 | | `win10-x64` | `2.7.0` | 2023-07-24 | | `win11-arm` | `2.7.0` | 2023-09-26 | @@ -293,23 +293,40 @@ may not work on every platform. ### Perl -The Perl binding for Duktape is available on CPAN: +The Perl binding for Duktape is available as `JavaScript::Duktape` on CPAN. + +The Perl binding does not have raw `Buffer` ops, so Base64 strings are used. + +#### Perl Demo + +:::note + +This demo was tested in the following deployments: + +| Architecture | Version | Date | +|:-------------|:--------|:-----------| +| `darwin-x64` | `2.5.0` | 2023-10-26 | + +::: + +0) Ensure `perl` and `cpan` are installed and available on the system path. + +1) Install the `JavaScript::Duktape` library: ```bash cpan install JavaScript::Duktape ``` -The Perl binding does not have raw `Buffer` ops, so Base64 strings are used. -With the [ExtendScript](/docs/getting-started/installation/extendscript) build: +2) Save the following codeblock to `SheetJSDuk.pl`: -```perl SheetJSDuk.pl +```perl title="SheetJSDuk.pl" # usage: perl SheetJSDuk.pl path/to/file use JavaScript::Duktape; use File::Slurp; use MIME::Base64 qw( encode_base64 decode_base64 ); # Initialize -my $js = JavaScript::Duktape->new( max_memory => 1024 * 1024 * 1024 ); +my $js = JavaScript::Duktape->new( max_memory => 256 * 1024 * 1024 ); $js->eval("var global = (function(){ return this; }).call(null);"); # Load the ExtendScript build @@ -325,15 +342,31 @@ $js->eval("log('SheetJS library version ' + XLSX.version);"); my $raw_data = encode_base64(read_file($ARGV[0], { binmode => ':raw' }), ""); $js->set("b64", $raw_data); $js->eval(qq{ - global.wb = XLSX.read(b64, {type: "base64"}); + global.wb = XLSX.read(b64, {type: "base64", WTF:1}); global.ws = wb.Sheets[wb.SheetNames[0]]; + void 0; }); # Print first worksheet CSV -my $csv = $js->eval('XLSX.utils.sheet_to_csv(global.ws)'); -print $csv +$js->eval('log(XLSX.utils.sheet_to_csv(global.ws))'); # Write XLSB file my $xlsb = $js->eval("XLSX.write(global.wb, {type:'base64', bookType:'xlsb'})"); write_file("SheetJSDuk.xlsb", decode_base64($xlsb)); -``` \ No newline at end of file +``` + +3) Download the SheetJS ExtendScript build and test file: + +{`\ +curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.extendscript.js +curl -LO https://sheetjs.com/pres.xlsx`} + + +4) Run the script: + +```bash +perl SheetJSDuk.pl pres.xlsx +``` + +If the script succeeded, the data in the test file will be printed in CSV rows. +The script will also export `SheetJSDuk.xlsb`. \ No newline at end of file diff --git a/docz/docs/03-demos/42-engines/03-rhino.md b/docz/docs/03-demos/42-engines/03-rhino.md index 649a7f4..eeb0e9c 100644 --- a/docz/docs/03-demos/42-engines/03-rhino.md +++ b/docz/docs/03-demos/42-engines/03-rhino.md @@ -120,21 +120,26 @@ This string can be loaded into the JS engine and processed: :::note -This demo was tested on 2023-07-26 using Rhino 1.7.14. +This demo was tested on 2023-10-26 against Rhino 1.7.14. ::: -0) Ensure Java is installed. Create a folder for the project, download the -[JAR](https://repo1.maven.org/maven2/org/mozilla/rhino/1.7.14/rhino-1.7.14.jar) -and rename to `rhino.jar`: +0) Ensure Java is installed. + +1) Create a folder for the project: ```bash mkdir sheetjs-java cd sheetjs-java +``` + +2) Download the Rhino JAR and rename to `rhino.jar`: + +``` curl -L -o rhino.jar https://repo1.maven.org/maven2/org/mozilla/rhino/1.7.14/rhino-1.7.14.jar ``` -1) Download the SheetJS Standalone script and the test file. Save both files in +3) Download the SheetJS Standalone script and the test file. Save both files in the project directory: