Skip to content

Reading data in Electron Render Process #163

@martin-loland

Description

@martin-loland

Hello, I was wondering what is the recommended approach (or if it's even possible) to read data from parquet file in the render process of an Electron app?

Working in main process

import { readFileSync } from 'node:fs';
const parquet = require('@dsnp/parquetjs');

export async function readParquet(filePath: string) {
  const buffer = readFileSync(filePath);
  const reader = await parquet.ParquetReader.openBuffer(buffer);
  const meta = reader.getMetadata();
  console.log(meta);
}

Not working in render process

import parquetjs from '@dsnp/parquetjs/dist/browser/parquetjs.esm'

const buffer = window.electronAPI.fs.readFileSync(f);
console.log('Expecting PAR1:', new TextDecoder().decode(buffer.slice(0, 4)));
const reader = await parquetjs.ParquetReader.openBuffer(buffer);
const meta = reader.getMetadata();
console.log(meta);

Logs:

Expecting PAR1: PAR1
not valid parquet file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions