Comments (5)
Hey @tinchoz49, this is a bug, thanks for filing. We currently assume flags are in string form ('w+'
is closest to what you'd want), and don't yet support passing flags as a bitwise number. We should.
Fixing this would involve making our code do what node does:
- docs where it discusses
flags
being aString
orNumber
- code for
stringToFlags()
in node
A simple fix would be to alter our O_FLAGS
object to use numeric keys vs. strings, and convert strings to numbers like node does.
from filer.
@rscotchmer great, here are some more thoughts.
We currently use strings for flags, and we should switch to using numbers. If a string is passed to us, we should convert it into a number. See the code I linked to above from node, which does what we want.
Next, we do a bunch of checks all over like this: https://github.com/filerjs/filer/blob/master/src/filesystem/implementation.js#L622. Instead of doing this, we'd want to convert that to use the flags
number, and bitwise &
(and) it with the constant we want to check against. The constants we want are defined in https://github.com/filerjs/filer/blob/master/src/constants.js#L88.
We could start by converting the code in the first comment above into a test we add to the fs.open.spec.js
test file, and add more as we go. I have no doubt you'll find other bugs while fixing this, since we probably don't do the right thing in all cases with flags vs. what node does.
Let me know what questions you have, or further help I can give. I'm happy to guide you as you deem necessary.
from filer.
@rscotchmer not sure what you're looking to do for your 0.3 bugs, but this one might be interesting to you. I could mentor you through it, if you have interest. No pressure if you have other things you want to try next.
from filer.
@humphd I'd love to work on this! Thanks for notifying me!
from filer.
Hey everyone, thanks to start working on this!
from filer.
Related Issues (20)
- Add find_symlink_node() to allow l* methods (lstat, lchown, etc) to use find_node like functionality HOT 4
- Export FS type to the user HOT 2
- Shell.mkdirp does not support relative paths HOT 4
- Use case HOT 1
- npm test only running shim tests HOT 10
- Incorrect documentation for Buffer shim HOT 2
- path module not shimmed correctly
- BUG: unexpected failures when calling fs functions (e.g. writeFile) with empty options object HOT 4
- BUG: fs.readdir fails when passing options HOT 4
- BUG: fs.mkdir does not recursively create parent directories when called with { recursive: true } HOT 2
- Add tests for new code paths from PR #774 HOT 1
- fs.opendir not implemented
- Typescript Support HOT 2
- web ide: Support for File System Access APIs as a Storage Provider? HOT 7
- GitHub Actions Workflow failing
- Webpack entry cannot be found after importing filer HOT 15
- Shims are not available in NPM package HOT 8
- Critical dependency: the request of a dependency is an expression HOT 3
- Maintenance of Filer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filer.