cheminfo / pubchem

MIT License
7 stars 4 forks source link

PubChem

NPM version build status Test coverage npm download

Simplify the retrieval of information from PubChem using the PubChem JSON API.

Installation

$ npm i pubchem

Usage

import { Compound } from 'pubchem';

async function doAll() {
  const compound = await Compound.fromSmiles('CCCCCBr', { cache });

  console.log(compound.getCID());

  const compoundData = await compound.getData();

  const ghs = compoundData.ghs;
  console.log(ghs);

  const detailedGHS = compoundData.getGHS();
  console.log(detailedGHS);

  const computed = compoundData.computed;

  console.log(computed);

  const experimentalData = compoundData.getExperimentalData({
    pressure: { targetUnits: 'torr' },
    temperature: { targetUnits: '°C' },
  });

  console.log(experimentalData);
}

doAll();

You can run a working example using:

node test/simple.js

CDN

Online demo

API Documentation

License

MIT