Skip to content

qqxs/got-github-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

got-github-examples

# get example01 template
yarn run dev
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();

About

download github project examples template

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published