Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.close is not a function #121

Open
yaplas opened this issue Mar 2, 2021 · 3 comments
Open

os.close is not a function #121

yaplas opened this issue Mar 2, 2021 · 3 comments

Comments

@yaplas
Copy link

yaplas commented Mar 2, 2021

I'm using a parquet stream to track api usage, and every seems working ok except for when I try to close the stream i get an error: `os.close is not a function'. I suppose it is happening here:

os.close((err) => {

I create the stream this way:

    const trackingStream = await parquet.ParquetWriter.openStream(
      schema,
      fileStream,
      {rowGroupSize: 2}, // batch size before flushing the output buffer
    );

where fileStream is a s3-upload-stream stream

then I append rows using appendRow, but when I try to close it I get the error.

s3-upload-stream stream does not have a close method, it has an end method, could be this the issue ? bc I suppose os is output stream. So I wondering if I need to wrap the s3-upload-stream into an object with a close method that internally call the end method ?

@designreact
Copy link

designreact commented May 18, 2021

You've probably sorted this now but if it helps another... Inline with your closing comment, here's how I got around this same issue:

import s3UploadStream = require('s3-upload-stream');
const s3Stream = s3UploadStream(S3);

...

const upload: S3WriteParquetStream = s3Stream.upload({ Bucket, Key });
upload.close = () => upload.end();

const writer = await parquet.ParquetWriter.openStream(schema, upload);

@nickjames640
Copy link

Hi @yaplas! I am running into this exact same issue using the TypeScript parquets library. Did you ever find a fix? I got it working using the parquetjs-lite library, but would prefer the TS one if possible.

@pcj
Copy link

pcj commented Sep 28, 2023

@nickjames640 old comment, but for future reference you can do:

                // @ts-ignore
                parquetWritable.close = () => parquetWritable.end();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants