-
Notifications
You must be signed in to change notification settings - Fork 58
backFile(): add http-backed files to superblock #32
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
Conversation
bf81d6c
to
79984ac
Compare
Provides for HTTP backing of files when there is no .superblock.txt file.
I removed my old comment after noticing a promise that wasn't waited for, but I still do not see a reason for this test failure. I tried testing the |
Maybe it's a permissions thing. I'll try re-running it 🤷♂ |
Yes, I think it's a CI configuration thing... the environment variables aren't available to PRs created on forks. It's surprisingly tricky to make that work right without accidentally making it so anyone can steal your npm or Github tokens by opening a PR. I actually do like this addition, so I think I will merge it! Don't worry about the CI, I'll figure that out tomorrow and take a closer look at this. Mostly I'm wondering if I can make |
🎉 This PR is included in version 3.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
So I've been thinking about it, and I have too many ideas. I want to add a "hooks" API so that users can register interceptor functions to run before or after each method. Then you could do something like: fs.after('readFile', async (path, content) => {
// Lazily detect "index" files when they are read by the application
if (path.endsWith('/objects/info/packs')) {
let root = path.replace(/\/objects\/info\/packs$/, '')
// Parse their contents
for (let pack of content.match(/pack-.{40}\.pack/g)) {
// Inject new files and directories into the file system
await this.addInode({
filepath:`${root}/objects/pack/${pack.slice(0, 45)}.idx`,
type: 'file',
size: await fetch({ url, method: 'HEAD' }).headers.contentLength
})
}
}
}) But clearly my designing and scheming would take too long and slow you down - you've already made 3 PRs! So screw it, we'll settle for |
Well, the other 2 PRs didn't depend on this one =) But thank you! Looking forward to the newer API when you put all the pieces together. I'm thinking the simple generic approach might be to make mount plugins, and HTTP and IDB would be separate ones. |
Provides for HTTP backing of files when there is no .superblock.txt file or when it is missing content.
These changes allow for a crude alternative to 'dumb' HTTP git remotes as in isomorphic-git/isomorphic-git#672 . A third-party server folder can now back the filesystem directly and be used as a copy-on-write git store, with this PR and some basic boilerplate such as: