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

TypeError: dntShim.Deno.seekSync is not a function #142

Open
alexgleason opened this issue Apr 17, 2023 · 3 comments
Open

TypeError: dntShim.Deno.seekSync is not a function #142

alexgleason opened this issue Apr 17, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@alexgleason
Copy link

When trying to transpile with shims, I get the following error:

FAILURES

blocks events that post the same content too quickly
  TypeError: dntShim.Deno.seekSync is not a function
      at js_read (file:///home/alex/Projects/strfry-policies/npm/esm/deps/deno.land/x/sqlite@v3.7.1/build/vfs.js:42:26)
      at wasm://wasm/0027cea2:wasm-function[84]:0x16fc
      at wasm://wasm/0027cea2:wasm-function[379]:0x236f6
      at wasm://wasm/0027cea2:wasm-function[373]:0x22415
      at wasm://wasm/0027cea2:wasm-function[385]:0x23c12
      at wasm://wasm/0027cea2:wasm-function[20]:0xf0f
      at wasm://wasm/0027cea2:wasm-function[1407]:0x9311b
      at file:///home/alex/Projects/strfry-policies/npm/esm/deps/deno.land/x/sqlite@v3.7.1/src/db.js:86:135
      at setStr (file:///home/alex/Projects/strfry-policies/npm/esm/deps/deno.land/x/sqlite@v3.7.1/src/wasm.js:13:24)
      at new DB (file:///home/alex/Projects/strfry-policies/npm/esm/deps/deno.land/x/sqlite@v3.7.1/src/db.js:86:24)error: Uncaught (in promise) Error: npm run test failed with exit code 1
        throw new Error(
              ^
    at runCommand (https://deno.land/x/dnt@0.34.0/lib/utils.ts:57:15)
    at async build (https://deno.land/x/dnt@0.34.0/mod.ts:386:5)
    at async file:///home/alex/Projects/strfry-policies/scripts/npm.ts:5:1
@dsherret dsherret transferred this issue from denoland/dnt May 9, 2023
@dsherret dsherret added the enhancement New feature or request label May 9, 2023
@dsherret
Copy link
Member

dsherret commented May 9, 2023

I looked into this briefly and it seems that Node doesn't have a way to seek from the current position or end of the file. It seems some people do it by adding native bindings (ex. https://github.com/baudehlo/node-fs-ext/blob/3125353321c30bd35fc38e40ce76ffe3872e215b/fs-ext.js#L113).

I tried to at least have seek from the start of the file, but it didn't seem to work: https://github.com/dsherret/node_deno_shims/tree/seek

@AlexanderOMara
Copy link

AlexanderOMara commented Nov 5, 2024

Currently null is being passed to read, so it uses the current file offset.

const { bytesRead } = await _read(rid, buffer, 0, buffer.length, null);

In the absence of a way to seek, I think the only way to do this would be to internally track the position instead of passing null.

https://nodejs.org/api/fs.html#fsreadfd-buffer-offset-length-position-callback

Would need to setup some mapping between FD and position.

@AlexanderOMara
Copy link

Create a PR to implement seek functions in the only way I think is really possible.

#189

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

No branches or pull requests

3 participants