#!/bin/bash # https://docs.sheetjs.com/docs/demos/frontend/bundler/browserify cd /tmp rm -rf sheetjs-browserify-tests mkdir sheetjs-browserify-tests cd sheetjs-browserify-tests for n in {3..17}; do mkdir sheetjs-browserify-$n cd sheetjs-browserify-$n npm init -y npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz puppeteer express@4 cat >index.js < index.min.js cat >index.html <

SheetJS Presidents Demo

EOF cat >test.js < { await new Promise((res,rej) => setTimeout(res, 1000)); const browser = await puppeteer.launch(); const page = await browser.newPage(); page.on("console", msg => console.log("PAGE LOG:", msg.text())); await page.setViewport({width: 1920, height: 1080}); const client = await page.target().createCDPSession(); await client.send('Browser.setDownloadBehavior', { behavior: 'allow', downloadPath: require("path").resolve('./') }); await page.goto('http://localhost:7262/'); await page.click("#xport"); await new Promise((res,rej) => setTimeout(res, 1000)); await browser.close(); process.exit(); }); EOF node test.js npx -y xlsx-cli Presidents.xlsx | head -n 3 cd - done