Removed dependency on fs

This commit is contained in:
Ali Camarata 2023-04-02 08:20:42 -04:00
parent 2a729af7d1
commit 9fc46f0784
3 changed files with 9 additions and 4 deletions

View file

@ -1,6 +1,6 @@
{
"name": "solar-spa",
"version": "1.1.1",
"version": "1.2.0",
"description": "NREL Solar Position Algorithm (SPA) in WebAssembly",
"main": "solar-spa.js",
"types": "index.d.ts",

View file

@ -1,9 +1,12 @@
// solar-spa.js
const path = require('path');
const spaModule = require('./spa.js');
const spaBase64 = require('./spa_base64.js'); // Import the Base64-encoded WASM
// Set the wasm file path
spaModule.wasmBinaryFile = path.join(__dirname, 'spa.wasm');
// Convert the Base64-encoded string back to a Uint8Array for use with WebAssembly
const wasmBinary = new Uint8Array(Buffer.from(spaBase64, 'base64'));
// Use the wasmBinary directly instead of loading it from the file system
spaModule.wasmBinary = wasmBinary;
module.exports = function spa(
date,

2
spa_base64.js Normal file

File diff suppressed because one or more lines are too long