docs.sheetjs.com/tests/bigdata/stream-nodejs.ps1
2026-01-28 23:58:19 -05:00

20 lines
742 B
PowerShell

#!/usr/bin/env pwsh
# https://docs.sheetjs.com/docs/demos/bigdata/stream#nodejs
$oldDir = Get-Location
$tempDir = Join-Path -Path $env:TEMP -ChildPath "sheetjs-stream"
if (Test-Path -Path $tempDir) { Remove-Item -Path $tempDir -Recurse -Force }
New-Item -ItemType Directory -Path $tempDir | Out-Null
Set-Location -Path $tempDir
npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz
Invoke-WebRequest -Uri "https://docs.sheetjs.com/stream/SheetJSNodeJStream.js" -OutFile "SheetJSNodeJStream.js"
Invoke-WebRequest -Uri "https://docs.sheetjs.com/pres.xlsx" -OutFile "pres.xlsx"
# Test with current Node.js version
node --version
node SheetJSNodeJStream.js pres.xlsx
Set-Location $oldDir
Remove-Item -Path $tempDir -Recurse -Force