Skip to content

Instantly share code, notes, and snippets.

@martin12333
Created November 11, 2019 18:56
Show Gist options
  • Save martin12333/6b18a45cdf2910ccbcf37d1b238fdf3b to your computer and use it in GitHub Desktop.
Save martin12333/6b18a45cdf2910ccbcf37d1b238fdf3b to your computer and use it in GitHub Desktop.
BrowserFS / isomorphic-git test
<script src="https://unpkg.com/browserfs"></script>
<script src="https://unpkg.com/isomorphic-git"></script>
<script>
async function main () {
}
BrowserFS.configure({ fs: "IndexedDB", options: {} }, function (err) {
if (err) return console.log(err);
window.fs = BrowserFS.BFSRequire("fs");
git.plugins.set('fs', window.fs);
git.clone({
dir: '.',
corsProxy: 'https://cors.isomorphic-git.org',
url: 'https://github.com/isomorphic-git/isomorphic-git',
singleBranch: true,
depth: 1
})
fs.readdir('.', (err, res) => res.map(
entry => fs.readdir(`./${entry}`, (err, res) => console.log(entry, res, err ? 'not a dir' : ''))
))
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment