Code Monkey home page Code Monkey logo

Comments (8)

andipaetzold avatar andipaetzold commented on September 27, 2024

👋

Unfortunately, I am unable to reproduce your issue. When running the browser example locally and reading all data from a database with complex/long columns, everything works fine.

Looking at the code of readInt32LE, I am not sure why it would fail for offset being undefined as the first line (offset = offset >>> 0) turns the undefined to 0 which passes the offset check.

I have in mind though that I ran into some issues like this before. But I'd like to be able to reproduce the issue myself before updating the code.

from mdb-reader.

sspa-dhayes avatar sspa-dhayes commented on September 27, 2024

this is the same thing I was seeing in: #207 (comment)

...i thought it was a webpack issue, but tried with a setup similar to ahaganDEV

my workaround was to add the zero index when reading from the buffers in:
\src\data\bigint.ts
image

\src\data\byte.ts
image

\src\data\complexOrLong.ts
image

\src\data\datetime.ts
image

\src\data\double.ts
image

\src\data\float.ts
image

\src\data\integer.ts
image

from mdb-reader.

andipaetzold avatar andipaetzold commented on September 27, 2024

@sspa-dhayes Could you provide a sample repo or code sandbox so I can reproduce the issue? For me things worked in the browser :(

That way I can also add tests to avoid this from happening in the future (by adding tests/linting).

I am happy to release a new version once I was able to reproduce. The required changes seem to be quite minimal.

from mdb-reader.

andipaetzold avatar andipaetzold commented on September 27, 2024

@ahaganDEV @sspa-dhayes I am very happy to update this package to fix your issue. But first, I'd like to be able to reproduce it. I tried to use the package within the browser and everything worked for me.

I only want to prevent releasing a "fix" to an error that is actually caused by webpack (config) and not of this package.

from mdb-reader.

ahaganDEV avatar ahaganDEV commented on September 27, 2024

I don't believe the issue is webpack? When debugging within the browser, I can confirm that it is using the Buffer package. I forked the mdb-library library and amended some of the functions that interact with Buffer and worked perfectly fine. Chaging:

export function readComplexOrLong(buffer: Buffer): number {
return buffer.readInt32LE();
}

to:

export function readComplexOrLong(buffer: Buffer): number {
return buffer.readInt32LE(0);
}

from mdb-reader.

andipaetzold avatar andipaetzold commented on September 27, 2024

I tried to reproduce the issue by moving the browser example to webpack: https://github.com/andipaetzold/mdb-reader-issue-218.I don' receive any errors when loading a database.

Can you please check what code is executed when calling readInt32LE. Is it really this: https://github.com/feross/buffer/blob/795bbb5bda1b39f1370ebd784bea6107b087e3a7/index.js#L1309-L1317 ? Or are you maybe using an older version of the package where the offset doesn't default to 0.

from mdb-reader.

andipaetzold avatar andipaetzold commented on September 27, 2024

Closing because I cannot reproduce the issue.

Feel free to reopen if you can provide a repo or similar that shows the issue.

from mdb-reader.

mnappo avatar mnappo commented on September 27, 2024

@ahaganDEV If you are still having this issue - my post to #207 worked for me. Webpack/CRA was not using the buffer package. Apparently Webpack 4 shims some nodejs functions on its own...

from mdb-reader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.