Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@begit/core

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@begit/core - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

LICENSE

2

dist/index.js

@@ -1,2 +0,2 @@

import{join as g}from"path";import{createWriteStream as y}from"fs";import{mkdir as w}from"fs/promises";import{Readable as x}from"stream";import{finished as b}from"stream/promises";import{homedir as L,tmpdir as u}from"os";import{dirname as $,join as m}from"path";var E=()=>{let r=process.env.XDG_CACHE_HOME??u();return m(r,".begit")},p=()=>m(E(),"cache"),l=async(r,o,t)=>{t=t??"HEAD";let a=await fetch(`https://github.com/${r}/${o}/tarball/${t}`);return{body:a.body,name:a.url.split("/").pop()}},h=async(r,o)=>{await w($(r.toString()),{recursive:!0});let t=y(r);await b(x.fromWeb(o.body).pipe(t))},f=async(r,o)=>(await(await fetch(`https://api.github.com/repos/${r}/${o}/commits?per_page=1`)).json())[0].sha;import{existsSync as C}from"fs";import{extract as D,list as S}from"tar";import{mkdir as A,unlink as R}from"fs/promises";var k=async r=>{let{owner:o,name:t,branch:a}=r,n=await f(o,t),e=g(p(),`${o}-${t}-${n}.tar.gz`);if(C(e))return e;let i=await l(o,t,a);return await h(e,i),e},F=async r=>{let o=[];return await S({file:r,onentry:t=>o.push(t.path)}),o},T=async(r,o,t=null,a=!1)=>{t&&(t=t?.startsWith("/")?t:`/${t}`,t=t?.endsWith("/")?t:`${t}/`),await A(o,{recursive:!0});let e=(await F(r)).find(s=>t?s.includes(t):!1);if(t&&!e)throw new Error("Subdirectory not found");let i=e?e.split("/").length-1:1;await new Promise((s,d)=>D({file:r.toString(),strip:i,C:o,k:!a},e?[e]:void 0,c=>{c&&d(c),s()}))},N=async({repo:r,dest:o,cwd:t,opts:a={cache:!0}})=>{let n=a.cache;t=t??process.cwd(),o=o??r.name;let e=await k(r);await T(e,g(t,o),r.subdir),n||await R(e)};export{N as downloadAndExtract,k as downloadToFile,T as extractFile};
import{join as g}from"path";import{createWriteStream as x}from"fs";import{mkdir as b}from"fs/promises";import{Readable as u}from"stream";import{finished as A}from"stream/promises";import{homedir as L,tmpdir as E}from"os";import{dirname as R,join as m}from"path";var $=()=>{let a=process.env.XDG_CACHE_HOME??E();return m(a,".begit")},p=()=>m($(),"cache"),l=async(a,r,t)=>{t=t??"HEAD";let e=await fetch(`https://github.com/${a}/${r}/tarball/${t}`);return{body:e.body,name:e.url.split("/").pop()}},h=async(a,r)=>{await b(R(a.toString()),{recursive:!0});let t=x(a);await A(u.fromWeb(r.body).pipe(t))},d=async(a,r)=>(await(await fetch(`https://api.github.com/repos/${a}/${r}/commits?per_page=1`)).json())[0].sha;import{existsSync as C}from"fs";import{extract as D,list as S}from"tar";import{mkdir as T,unlink as w}from"fs/promises";var k=async a=>{let{owner:r,name:t,branch:e}=a,n=await d(r,t),o=g(p(),`${r}-${t}-${n}.tar.gz`);if(C(o))return o;let i=await l(r,t,e);return await h(o,i),o},F=async a=>{let r=[];return await S({file:a,onentry:t=>r.push(t.path)}),r},O=async(a,r,t=null,e=!1)=>{t&&(t=t?.startsWith("/")?t:`/${t}`,t=t?.endsWith("/")?t:`${t}/`),await T(r,{recursive:!0});let o=(await F(a)).find(s=>t?s.includes(t):!1);if(t&&!o)throw new Error("Subdirectory not found");let i=o?o.split("/").length-1:1;await new Promise((s,y)=>D({file:a.toString(),strip:i,C:r,k:!e},o?[o]:void 0,c=>{c&&y(c),s()}))},f=async({repo:a,dest:r,cwd:t,opts:e={cache:!0}})=>{let n=e.cache;t=t??process.cwd(),r=r??a.name;let o=await k(a);await O(o,g(t,r),a.subdir),n||await w(o)},B=async a=>{try{await f(a)}catch(r){if(r.tarCode!=="TAR_ABORT")throw r;let t=r.file;await w(t),await f(a)}};export{f as downloadAndExtract,B as downloadRepo,k as downloadToFile,O as extractFile};
//# sourceMappingURL=index.js.map
{
"name": "@begit/core",
"version": "0.0.13",
"version": "0.0.14",
"description": "Blazingly fast tool for cloning git repositories, with no reliance on local `git`, or `tar` installs",
"author": "",
"author": "Thomas Beer",
"license": "MIT",

@@ -26,10 +26,10 @@ "homepage": "https://github.com/Tommypop2/begit",

"devDependencies": {
"@types/node": "^20.11.16",
"@types/tar": "^6.1.11",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"vitest": "^1.2.2"
"@types/node": "^20.12.6",
"@types/tar": "^6.1.12",
"tsup": "^8.0.2",
"typescript": "^5.4.4",
"vitest": "^1.4.0"
},
"dependencies": {
"tar": "^6.2.0"
"tar": "^6.2.1"
},

@@ -36,0 +36,0 @@ "publishConfig": {

@@ -21,1 +21,2 @@ export type Repository = {

export declare const downloadAndExtract: ({ repo, dest, cwd, opts, }: DownloadAndExtract) => Promise<void>;
export declare const downloadRepo: (opts: DownloadAndExtract) => Promise<void>;
/// <reference types="node" />
/// <reference types="node" />
import { PathLike } from "fs";
import { type PathLike } from "fs";
import type { ReadableStream } from "stream/web";

@@ -5,0 +5,0 @@ export declare const homedir: () => string;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc