@zakodium/nmrium-core
v0.6.2
Published
The core of NMRium: types, state, state migration and plugin system.
Downloads
2,900
Readme
nmrium-core
Package containing core feature to work with nmrium. It provide essentials types. Provide state and migrate it for different version of NMRium. Delegate loading and processing state to plugins.
It contains the following features:
- read: read a file and return a data structure with the spectra and molecules for
.nmriumfiles - plugin system: allow to register plugins to handle different file formats
- serialize: Serialize the state
Installation
$ npm i @zakodium/nmrium-core
Usage
import { FileCollection } from 'file-collection';
import { NMRiumCore } from '@zakodium/nmrium-core';
import plugins from '@zakodium/nmrium-core-plugins';
const core = new NMRiumCore();
core.registerPlugins(plugins);
const fileCollection = FileCollection.fromPath('path_to_data');
// we can read a zip, jdx, jdf, nmredata, json, nmrium file extensions
const result = await core.read(fileCollection, options);
// based on extension we choose the format processor
console.log(result);
// return {
// spectra: [],
// molecules: [],
// }
// readSource function accept a partial FileCollectionItems and a baseURL to generate a
// data structure with a source object inside with { files, filter, baseURL }
const nmriumObject = await core.readFromWebSource(
{
baseURL: 'https://cheminfo.github.io',
files: [
{
name: 'aspirin-1h.zip',
relativePath: 'bruker-data-test/data/zipped/aspirin-1h.zip',
},
],
},
{},
);License
© 2025 Zakodium Sàrl. This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. CC BY-NC-SA 4.0
This package is based on MIT-licensed code that can be found here: https://doi.org/10.5281/zenodo.7100132
