Skip to content

BenthamInstruments/ben-to-json

Repository files navigation

BenWin+ .ben binary file to JSON converter

Node CI Publish package on release

ben-to-json

Read spectrum files produced by Bentham's BenWin+ Software in Javascript

Install

  • npm install @bentham-instruments/ben-to-json

Examples

Using require

const { parse } = require('@benthaminstruments/ben-to-json');

const fs = require('fs');

const ben_file_data = fs.readFileSync('spectra.ben');
let json = parse(ben_file_data);

console.log(json);

Using import

import { parse } from '@benthaminstruments/ben-to-json';

import {readFileSync} from 'fs';

const ben_file_data = readFileSync('spectra.ben');
let json = parse(ben_file_data);

console.log(json);

Full-ICU (Pre Node v13)

If you are using an old version of node, pre v13, then it needs to be run with in a special way as these older versions were not built with full international support by default.

This support can be added by using the NODE_ICU_DATA to point to an installed version of the full-icu package. e.g. "cross-env NODE_ICU_DATA=./node_modules/full-icu node script.js