An open API service indexing awesome lists of open source software.

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

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();
```