How to use @cumulus/pvl - 10 common examples

To help you get started, we’ve selected a few @cumulus/pvl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nasa / cumulus / packages / ingest / parse-pdr.js View on Github external
const pdrFile = await fs.readFile(pdrFilePath, 'utf8');

  // Investigating CUMULUS-423
  if (pdrFile.trim().length === 0) throw new Error(`PDR file had no contents: ${pdrFilePath}`);

  // because MODAPS PDRs do not follow the standard ODL spec
  // we have to make sure there are spaces before and after every
  // question mark
  let pdrString = pdrFile.replace(/((\w*)=(\w*))/g, '$2 = $3');

  // temporary fix for PVL not recognizing quoted strings as symbols
  pdrString = pdrString.replace(/"/g, '');

  let parsed;
  try {
    parsed = pvl.pvlToJS(pdrString);
  }
  catch (e) {
    throw new PDRParsingError(e.message);
  }

  return parsed;
}
github nasa / cumulus / packages / api / models / pdrs.js View on Github external
static generatePDRD(err) {
    return pvl.jsToPVL(
      new pvl.models.PVLRoot()
        .add('MESSAGE_TYPE', new pvl.models.PVLTextString('SHORTPDRD'))
        .add('DISPOSITION', new pvl.models.PVLTextString(err.message))
    );
  }
github nasa / cumulus / packages / api / models / pdrs.js View on Github external
static generatePAN() {
    return pvl.jsToPVL(
      new pvl.models.PVLRoot()
        .add('MESSAGE_TYPE', new pvl.models.PVLTextString('SHORTPAN'))
        .add('DISPOSITION', new pvl.models.PVLTextString('SUCCESSFUL'))
        .add('TIME_STAMP', new pvl.models.PVLDateTime(new Date()))
    );
  }
github nasa / cumulus / packages / api / models / pdrs.js View on Github external
static generatePDRD(err) {
    return pvl.jsToPVL(
      new pvl.models.PVLRoot()
        .add('MESSAGE_TYPE', new pvl.models.PVLTextString('SHORTPDRD'))
        .add('DISPOSITION', new pvl.models.PVLTextString(err.message))
    );
  }
github nasa / cumulus / packages / api / models / pdrs.js View on Github external
static generatePAN() {
    return pvl.jsToPVL(
      new pvl.models.PVLRoot()
        .add('MESSAGE_TYPE', new pvl.models.PVLTextString('SHORTPAN'))
        .add('DISPOSITION', new pvl.models.PVLTextString('SUCCESSFUL'))
        .add('TIME_STAMP', new pvl.models.PVLDateTime(new Date()))
    );
  }
github nasa / cumulus / packages / api / models / pdrs.js View on Github external
static generatePAN() {
    return pvl.jsToPVL(
      new pvl.models.PVLRoot()
        .add('MESSAGE_TYPE', new pvl.models.PVLTextString('SHORTPAN'))
        .add('DISPOSITION', new pvl.models.PVLTextString('SUCCESSFUL'))
        .add('TIME_STAMP', new pvl.models.PVLDateTime(new Date()))
    );
  }
github nasa / cumulus / packages / api / models / pdrs.js View on Github external
static generatePAN() {
    return pvl.jsToPVL(
      new pvl.models.PVLRoot()
        .add('MESSAGE_TYPE', new pvl.models.PVLTextString('SHORTPAN'))
        .add('DISPOSITION', new pvl.models.PVLTextString('SUCCESSFUL'))
        .add('TIME_STAMP', new pvl.models.PVLDateTime(new Date()))
    );
  }
github nasa / cumulus / packages / api / models / pdrs.js View on Github external
static generatePAN() {
    return pvl.jsToPVL(
      new pvl.models.PVLRoot()
        .add('MESSAGE_TYPE', new pvl.models.PVLTextString('SHORTPAN'))
        .add('DISPOSITION', new pvl.models.PVLTextString('SUCCESSFUL'))
        .add('TIME_STAMP', new pvl.models.PVLDateTime(new Date()))
    );
  }
github nasa / cumulus / packages / api / models / pdrs.js View on Github external
static generatePDRD(err) {
    return pvl.jsToPVL(
      new pvl.models.PVLRoot()
        .add('MESSAGE_TYPE', new pvl.models.PVLTextString('SHORTPDRD'))
        .add('DISPOSITION', new pvl.models.PVLTextString(err.message))
    );
  }

@cumulus/pvl

Parse and serialize Parameter Value Language, a data markup language used by NASA

Apache-2.0
Latest version published 15 days ago

Package Health Score

82 / 100
Full package analysis