@begit/core
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,2 +0,2 @@ | ||
import{join as h}from"path";import{createWriteStream as g}from"fs";import{mkdir as y}from"fs/promises";import{Readable as f}from"stream";import{finished as b}from"stream/promises";import{homedir as O,tmpdir as w}from"os";import{dirname as u,join as s}from"path";var x=()=>{let r=process.env.XDG_CACHE_HOME??w();return s(r,".begit")},c=()=>s(x(),"cache"),m=async(r,e,t)=>{t=t??"HEAD";let o=await fetch(`https://github.com/${r}/${e}/tarball/${t}`);return{body:o.body,name:o.url.split("/").pop()}},p=async(r,e)=>{await y(u(r.toString()),{recursive:!0});let t=g(r);await b(f.fromWeb(e.body).pipe(t))},l=async(r,e)=>(await(await fetch(`https://api.github.com/repos/${r}/${e}/commits?per_page=1`)).json())[0].sha;import{existsSync as $}from"fs";import{extract as E,list as P}from"tar";import{mkdir as k}from"fs/promises";var A=async(r,e={cache:!0})=>{let{owner:t,name:o,branch:a}=r,n=await l(t,o),i=h(c(),`${t}-${o}-${n}.tar.gz`);if($(i))return i;let d=await m(t,o,a);return await p(i,d),i},L=async r=>{let e=[];return await P({file:r,onentry:t=>e.push(t.path)}),e},R=async(r,e,t=null)=>{t=t?.startsWith("/")?t:`/${t}`,await k(e,{recursive:!0});let a=(await L(r)).find(n=>t?n.includes(t):!1);E({file:r.toString(),strip:t?t.split("/").length:1,C:e},a?[a]:void 0)},X=async({repo:r,dest:e,cwd:t})=>{t=t??process.cwd(),e=e??r.name;let o=await A(r);await R(o,h(t,e),r.subdir)};export{X as downloadAndExtract,A as downloadToFile,R as extractFile}; | ||
import{join as h}from"path";import{createWriteStream as g}from"fs";import{mkdir as y}from"fs/promises";import{Readable as b}from"stream";import{finished as f}from"stream/promises";import{homedir as O,tmpdir as u}from"os";import{dirname as w,join as s}from"path";var x=()=>{let r=process.env.XDG_CACHE_HOME??u();return s(r,".begit")},c=()=>s(x(),"cache"),m=async(r,e,t)=>{t=t??"HEAD";let o=await fetch(`https://github.com/${r}/${e}/tarball/${t}`);return{body:o.body,name:o.url.split("/").pop()}},p=async(r,e)=>{await y(w(r.toString()),{recursive:!0});let t=g(r);await f(b.fromWeb(e.body).pipe(t))},l=async(r,e)=>(await(await fetch(`https://api.github.com/repos/${r}/${e}/commits?per_page=1`)).json())[0].sha;import{existsSync as $}from"fs";import{extract as E,list as P}from"tar";import{mkdir as k}from"fs/promises";var A=async(r,e={cache:!0})=>{let{owner:t,name:o,branch:a}=r,n=await l(t,o),i=h(c(),`${t}-${o}-${n}.tar.gz`);if($(i))return i;let d=await m(t,o,a);return await p(i,d),i},L=async r=>{let e=[];return await P({file:r,onentry:t=>e.push(t.path)}),e},R=async(r,e,t=null)=>{t=t?.startsWith("/")?t:`/${t}`,await k(e,{recursive:!0});let a=(await L(r)).find(i=>t?i.includes(t):!1),n=a?a.split("/").length-1:1;E({file:r.toString(),strip:n,C:e},a?[a]:void 0)},X=async({repo:r,dest:e,cwd:t})=>{t=t??process.cwd(),e=e??r.name;let o=await A(r);await R(o,h(t,e),r.subdir)};export{X as downloadAndExtract,A as downloadToFile,R as extractFile}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@begit/core", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9942
5