https://github.com/qqxs/got-github-examples
download github project examples template
https://github.com/qqxs/got-github-examples
exampe github got tar typescript
Last synced: about 2 months ago
JSON representation
download github project examples template
- Host: GitHub
- URL: https://github.com/qqxs/got-github-examples
- Owner: qqxs
- License: mit
- Created: 2021-06-12T08:29:32.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-12T17:17:05.000Z (about 5 years ago)
- Last Synced: 2025-01-18T13:15:28.963Z (over 1 year ago)
- Topics: exampe, github, got, tar, typescript
- Language: TypeScript
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# got-github-examples
```bash
# get example01 template
yarn run dev
```
```ts
import got from "got";
import tar from "tar";
import path from "path";
import { Stream } from "stream";
import { promisify } from "util";
import { makeDir } from "./make-dir";
const pipeline = promisify(Stream.pipeline);
// tar extract 内容放置的路径
const root = path.resolve("data-fetch-app");
async function downloadExample() {
await makeDir(root);
process.chdir(root);
return pipeline(
got.stream(
// `https://codeload.github.com/${user}/${repo}/tar.gz/${branch}`
`https://codeload.github.com/qqxs/got-github-examples/tar.gz/main`
),
tar.extract(
{
cwd: root,
strip: 3
},
// [`${repo}-${branch}/${examplePath}`]
[`got-github-examples-main/examples/example01`]
)
);
}
downloadExample();
```