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: blob.text is not a function (nodeToFsa) #1071

Open
StephanMeijer opened this issue Oct 22, 2024 · 0 comments
Open

TypeError: blob.text is not a function (nodeToFsa) #1071

StephanMeijer opened this issue Oct 22, 2024 · 0 comments

Comments

@StephanMeijer
Copy link

StephanMeijer commented Oct 22, 2024

Cause

In my test I am using nodeToFsa1 in order to 'mock' the Origin Private File System (OPFS)2 API's that are available in the browser.

Application logic and tests can be found here.3

In OriginPrivateFileSystemStorage.load I am calling fileHandle.getFile()4. The expectation is that this function4 returns Promise<File>. Promise<File> was returned but the .text()5 method on File6 seems not to be properly implemented..

Reproduction

  1. Checkout https://gitlab.com/toegang-voor-iedereen/frontend/editor-app:
$ git checkout [email protected]:toegang-voor-iedereen/frontend/editor-app.git
# or
$ git checkout https://gitlab.com/toegang-voor-iedereen/frontend/editor-app.git
  1. run $ git checkout feature/NLD-264-opfs-memfs-issue
  2. run $ npm ci
  3. run $ npm run test -- src/storage/OriginPrivateFileSystemStorage.spec.ts

Versions

$ npm list | grep memfs
[email protected]
$ npm -v
10.8.2
$ node -v
v22.8.0

Footnotes

  1. https://github.com/streamich/memfs/blob/master/docs/fsa/fs-to-fsa.md

  2. https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system

  3. https://gitlab.com/toegang-voor-iedereen/frontend/editor-app/-/merge_requests/260

  4. https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/getFile 2

  5. https://developer.mozilla.org/en-US/docs/Web/API/Blob/text

  6. https://developer.mozilla.org/en-US/docs/Web/API/File#instance_methods

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

1 participant