Library to read in v5/v6 XPORT files using Node.js .
To add xport-js to your project, run
npm install xport-js
See the library documentation for details on methods and options available.
import Library from 'xport-js';
// Create a library instance
const lib = new Library('/path/to/ds.xpt');
// Get variable metadata
const metadata = await lib.getMetadata();
// Get dataset records as objects
let records = [];
for await (let obs of lib.read({ rowFormat: 'object' })) {
records.push(obs);
}
// Output contents of XPT file to CSV file(s)
await lib.toCsv('/outDir/')
This method return AsyncIterable which can be used in for await ... of statement.
lib.read(options);
Creates CSV file(s) in the outDir.
lib.read(outDir, options);
See read method options description for details.
This project is licensed under the MIT License - see the LICENSE file for details.