-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[fs] Add file.read
and file.seek
methods to the fs
module (2/3)
#3309
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## experimental/fs #3309 +/- ##
==================================================
Coverage ? 73.11%
==================================================
Files ? 261
Lines ? 20092
Branches ? 0
==================================================
Hits ? 14690
Misses ? 4460
Partials ? 942
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
file.read
and file.seek
methods to the fs
module
file.read
and file.seek
methods to the fs
modulefile.read
and file.seek
methods to the fs
module
file.read
and file.seek
methods to the fs
modulefile.read
and file.seek
methods to the fs
module
I did a round of reviewing, mostly looks good 👍 waiting for Mihail's comment to be addressed. |
7e0411d
to
516dace
Compare
495a651
to
f6e2042
Compare
516dace
to
79ba8f2
Compare
f6e2042
to
cdd1ea5
Compare
cdd1ea5
to
6d8dbb3
Compare
6d8dbb3
to
28ee0ef
Compare
file.read
and file.seek
methods to the fs
modulefile.read
and file.seek
methods to the fs
module (2/3)
Just for the record. I'm OK with merging this and working on the fix in a separate PR. The tiny commit that could be done is to write the test case, which should catch the bug and My rationale is that merging this will put the focus on fixing the bug. And we still have plenty of time until the release; in the worst case, we could be transparent that a known issue exists. However, some of the users of this experiment already could try to use it and provide feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What?
This Pull Request builds (and is based) upon #3142 and adds a
read
and aseek
method, the theFile
object exposed by thek6/experimental/fs
module.read
The
File.read
method allows to read a file into aUint8Array
. The amount of bytes read is equal to the size of the provided buffer.The method resolves to either the number of bytes read during the operation or EOF (represented as
null
) if there is nothing more to read.seek
The
File.seek
method allows to seek to a specifiedoffset
within a file under the givenwhence
.The offset is expressed in bytes. Whence allows you to seek from the start of the file (the offset needs to be strictly negative), the current position within the file (offset can be either positive or negative), or from the end of the file (offset needs to be strictly negative). A dedicated
SeekMode
type/enum is exposed to help with it.The method resolves to the new offset in bytes after the seek operation.
In action
Checklist
make ci-like-lint
) and all checks pass.make tests
) and all tests pass.Related PR(s)/Issue(s)
ref #3142
ref #2974
fixes #3145
fixes #3148