DLISFile

The top-level entry point. Represents one physical .dlis file on disk, which may contain one or more logical files.

import { DLISFile } from '@geoharkat/dlis-parser';

Static methods

DLISFile.fromBuffer(buffer)

Parse a DLIS file from an in-memory ArrayBuffer. Works in both the browser and Node.js. Synchronous.

Arguments:
  • buffer (ArrayBuffer) – Raw file bytes.

Returns:

A fully parsed DLISFile instance.

Return type:

DLISFile

// Browser
const buf  = await file.arrayBuffer();
const dlis = DLISFile.fromBuffer(buf);

// Node.js
import { readFileSync } from 'fs';
const buf  = readFileSync('well.dlis').buffer;
const dlis = DLISFile.fromBuffer(buf);
DLISFile.fromFile(filePath)

Parse a DLIS file from the filesystem. Node.js only — throws in browser environments. Asynchronous.

Arguments:
  • filePath (string) – Absolute or relative path to the .dlis file.

Returns:

Promise that resolves to a DLISFile.

Return type:

Promise<DLISFile>

const dlis = await DLISFile.fromFile('./data/well.dlis');

Properties

DLISFile.sul

The Storage Unit Label parsed from the first 80 bytes of the file.

Type:

StorageUnitLabel

console.log(dlis.sul.version);         // "V1.00"
console.log(dlis.sul.maxRecordLength); // 8192
console.log(dlis.sul.storageSetId);    // e.g. "Default Storage Set"

Fields:

Field

Type

Description

sequenceNumber

string

Storage unit sequence number

version

string

Always "V1.00" for RP66 V1

structure

string

Always "RECORD"

maxRecordLength

number

Maximum Visible Record length (bytes)

storageSetId

string

Free-form storage set identifier (60 chars)

DLISFile.logicalFiles

Array of all LogicalFile objects found in the file. Most DLIS files contain exactly one logical file, but multi-logical-file configurations are supported.

Type:

LogicalFile[]

DLISFile.warnings

Non-fatal parsing warnings accumulated during fromBuffer / fromFile. Inspect these to diagnose files that load but produce unexpected results.

Type:

string[]

if (dlis.warnings.length) {
  dlis.warnings.forEach(w => console.warn('[DLIS]', w));
}

Shortcuts (first logical file)

These properties forward to logicalFiles[0] for convenience when working with the common single-logical-file case.

DLISFile.origin

Acquisition/well metadata from the first logical file.

Type:

OriginInfo | null

DLISFile.frames

Frame registry of the first logical file.

Type:

Map<string, Frame>

DLISFile.channels

Channel registry of the first logical file.

Type:

Map<string, ChannelInfo>