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

fix(fslib): correct the FileHandle implementation #3889

Merged
merged 17 commits into from
Jul 20, 2022

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Dec 18, 2021

What's the problem this PR addresses?

The patched filesystem doesn't implement FileHandle correctly.

Depends on

How did you fix it?

Implemented most of the FileHandle methods.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@Josh-Cena
Copy link

@merceyz I got an error like TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type number (70) with the following code:

const handle = await fs.promises.open(filepath, 'r');
const { size } = await handle.stat();

And that number seems to be the file handle's fd number. I assume it will be fixed by this PR as well?

@merceyz
Copy link
Member Author

merceyz commented Apr 23, 2022

And that number seems to be the file handle's fd number. I assume it will be fixed by this PR as well?

@Josh-Cena Yes

@merceyz merceyz changed the title fix(fslib): map FileHandle functions to their fd counterpart fix(fslib): correct the FileHandle implementation Apr 23, 2022
@merceyz merceyz marked this pull request as ready for review April 23, 2022 18:05
@merceyz merceyz marked this pull request as draft April 23, 2022 20:21
@merceyz merceyz marked this pull request as ready for review April 23, 2022 20:55
@merceyz merceyz marked this pull request as draft May 22, 2022 11:32
@merceyz merceyz force-pushed the merceyz/fix/filehandle branch 2 times, most recently from 54a9b32 to 14378ba Compare May 24, 2022 20:39
@goloveychuk

This comment was marked as spam.

@merceyz merceyz marked this pull request as ready for review July 12, 2022 15:15
@merceyz merceyz force-pushed the merceyz/fix/filehandle branch 2 times, most recently from 496794c to b5866f5 Compare July 13, 2022 20:26
@merceyz merceyz requested a review from arcanis July 14, 2022 14:38
@merceyz merceyz enabled auto-merge (squash) July 14, 2022 14:39
@arcanis arcanis disabled auto-merge July 20, 2022 21:48
@arcanis arcanis merged commit e5de604 into master Jul 20, 2022
@arcanis arcanis deleted the merceyz/fix/filehandle branch July 20, 2022 21:49
merceyz added a commit that referenced this pull request Jul 20, 2022
* fix(fslib): map `FileHandle` functions to their fd counterpart

* fix: `FileHandle.write`

* refactor: avoid needing tslib update

* test: `FileHandle.read`

* test: `FileHandle.readFile`

* test: `FileHandle.appendFile`

* fix: `FileHandle.writeFile`

* refactor: use symbols for internals

* fix: ref counter

* fix: throw when when using a closed FileHandle

* fix: handle passing `FileHandle` to `fs.promises` functions

* fix: `FileHandle.writev`

* fix: `FileHandle.truncate`

* fix: `FileHandle.chmod`

* chore: versions

* chore: changelog

* chore: install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment