45 lines
1.0 KiB
Bash
Executable File
45 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# https://docs.sheetjs.com/docs/demos/engines/chakra
|
|
|
|
cd /tmp
|
|
rm -rf sheetjs-chakra
|
|
|
|
mkdir sheetjs-chakra
|
|
cd sheetjs-chakra
|
|
|
|
git clone https://github.com/chakra-core/ChakraCore.git
|
|
cd ChakraCore
|
|
git checkout 792ee76
|
|
cd ..
|
|
|
|
cd ChakraCore
|
|
./build.sh --static --icu=/usr/local/opt/icu4c/include --test-build -j=8 --no-jit
|
|
cd ..
|
|
|
|
curl -L -O https://docs.sheetjs.com/chakra/sheetjs.ch.cpp
|
|
curl -L -O https://docs.sheetjs.com/chakra/Makefile
|
|
|
|
make
|
|
|
|
curl -L -O https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js
|
|
curl -L -O https://docs.sheetjs.com/pres.numbers
|
|
|
|
./sheetjs.ch pres.numbers
|
|
|
|
cp ChakraCore/out/Test/ch .
|
|
|
|
node -e "fs.writeFileSync('payload.js', 'var payload = \"' + fs.readFileSync('pres.numbers').toString('base64') + '\";')"
|
|
|
|
cat <<EOF >global.js
|
|
var global = (function(){ return this; }).call(null);
|
|
EOF
|
|
|
|
cat <<EOF >chakra.js
|
|
var wb = XLSX.read(payload, {type:'base64'});
|
|
console.log(XLSX.utils.sheet_to_csv(wb.Sheets[wb.SheetNames[0]]));
|
|
EOF
|
|
|
|
cat global.js xlsx.full.min.js payload.js chakra.js > xlsx.chakra.js
|
|
|
|
./ch xlsx.chakra.js
|