https://github.com/chrispahm/node-gdx
Node.js bindings for GAMS GDX containers.
https://github.com/chrispahm/node-gdx
Last synced: 2 months ago
JSON representation
Node.js bindings for GAMS GDX containers.
- Host: GitHub
- URL: https://github.com/chrispahm/node-gdx
- Owner: chrispahm
- License: mit
- Created: 2019-03-20T16:41:47.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-23T14:57:15.000Z (over 1 year ago)
- Last Synced: 2024-10-29T21:21:19.209Z (7 months ago)
- Language: C
- Size: 2.38 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-gdx
Read GAMS GDX files in Node.js. Does NOT require a GAMS installation for macOS & Windows systems.## Installation
```
npm i node-gdx
```## Usage
```js
const gdx = require('node-gdx')({
gamsPath: "/path/to/gams/installation" // this is optional for macOS & Windows!
})// read a whole gdx file
gdx.read('path/to/file.gdx')
.then(data => {
/* where data = {
Demand: [{
'0': 'New-York',
Value: 324
},
...
]
}
*/
})
.catch(e => {
console.error(e)
})
// read a single symbol
gdx.read('path/to/file.gdx', 'Demand')
.then(data => {
/* where data = [{
'0': 'New-York',
Value: 324
},
...
]
*/
})
.catch(e => {
console.error(e)
})
```## API
### read(file: string, *symbol: string*, *overrideDllPath: string*)Read a GDX file from disk. Returns all symbols in the GDX container by default,
unless otherwise specified by the optional second function argument.