-
Notifications
You must be signed in to change notification settings - Fork 26
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
Sparse support #24
Sparse support #24
Conversation
Hilariously, travis is failing due to nodejs/node#25913 where for the longest time node's |
Ignore my bellyaching, I was being an idiot. Tests pass, if you want any changes feel free to request them, or modify them to your heart's content. |
Nice work, will review after I get my win laptop started 👨💻 |
btw, if you want me to run any benchmarks or specific downstream tests with hypercore let me know. |
@mafintosh is it possible to merge this, or give direction if this isn't the solution you're looking for? I'm hoping to use this module with larger video files and this sparse flag becomes very useful when the filesize is larger than a GB. |
I’ll try to land this, this weekend. Only concern is adding a big native dep, but I’ll see if we can extract what we need into a small napi module first |
It'd be awesome to have this. 💜 |
Yep getting close to being done factoring this into our existing native dep |
As a learning experience I made https://github.com/xori/set-sparse. I've never published a native module package before, so you won't hurt my feelings if you don't use it, but I thought I should share this with you. Library size is 97.6k vs 489k from |
@xori that's awesome! mind if integrate this into a small single one that has the native stuff we need (locking and win sparseness)? In general we always use prebuildify for our native deps for the install speed bump plus the fallbacks. |
@xori I included your code here https://github.com/mafintosh/fsctl so we can collect all the native utils we use in one tiny place. Note we only need it to work on fds so it's even simpler :) |
Has windows, linux, osx and osx M1 prebuilts bundled. Need to get my rasperry running so I can build those as well. Would anyone be interested in adding support for a sparse function option to the random-access-file module to allow us to pass this down? Similar to how we pass the lock function down. |
(I added it in master) |
Used in hypercore 9.9.0 if you use the default file storage |
Utilizing the
fswin
package, upon opening a file, set the sparse flag in Windows, this operation takes 0.1ms on my computer so I believe it's safe to do on every file open.I also included some tests that only run in Windows. I might have let it get out of hand with all the callbacks, but the callback style of this project triggered my nostalgia for a time before promises. Feel free to not include them, or let me know if you'd prefer me to remake them (or anything else) using modern technology or a different methodology.
This closes #23 and will be a pivotal step towards closing hypercore#281