-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiles.js
More file actions
37 lines (34 loc) · 1.1 KB
/
files.js
File metadata and controls
37 lines (34 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/** @satisfies {import('@webcontainer/api').FileSystemTree} */
export const files = {
'index.js': {
file: {
contents: `
const https = require('https'); // or 'https' for https:// URLs
const { argv } = require('process');
const unzipper = require('unzipper')
// Zip - https://codeload.github.com/suryamodulus/moviebuzz/zip/refs/heads/main
// Tar - https://codeload.github.com/suryamodulus/moviebuzz/tar.gz/refs/heads/main
function downloadGithubRepo(githubUrl, branch, dir = 'gh-repo'){
const url = 'https://codeload.github.com/suryamodulus/moviebuzz/zip/refs/heads/main'
https.get(url, function (response) {
response.pipe(unzipper.Extract({ path: dir }));
});
}
downloadGithubRepo(argv[2], argv[3], argv[4])`,
},
},
'package.json': {
file: {
contents: `
{
"name": "example-app",
"dependencies": {
"unzipper": "latest"
},
"scripts": {
"start": "nodemon index.js"
}
}`,
},
},
};