Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
git-essentials
Advanced tools
A collection of essential Git commands for your browser and Node.js
A collection of essential Git commands for your browser and Node.js written in TypeScript all without any native dependencies.
The library aims for 100% interoperability with the canonical git implementation. This means it does all its operations by modifying files in a .git
directory just like the git you are used to.
The API has been designed to provide functionality as individual functions, code bundlers can produce smaller bundles by including only the functions your application uses (tree shaking). The bundled version of the package is not included.
The documentation for the project is auto-generated from the source code so it will always be the most accurate representation of the actual code.
The project is written in TypeScript which gives more confidence in making any changes in contrast to plain JavaScript. In addition, it makes code reading and debugging much easier. Source maps are also included so you can jump right into implementation from your code.
Visit https://noteshubapp.github.io/git-essentials to view the full documentation.
You can install it from npm:
npm i git-essentials
import fs from 'fs/promises'
import { clone } from 'git-essentials'
import { makeNodeHttpClient } from 'git-essentials/clients/http/NodeHttpClient'
const http = makeNodeHttpClient()
const dir = 'repos/Welcome'
const url = 'https://github.com/NotesHubApp/Welcome.git'
await clone({ fs, http, dir, url })
GitHub (like many other providers) does not return proper Access-Control-Allow-Origin
header for non-API requests.
As a result, the browser will refuse to serve those requests. To overcome this limitation you can use CORS proxy server.
Please use the CORS proxy server from the example below only for testing purposes. You can fork this CORS proxy server and host it by your own.
import { clone } from 'git-essentials'
import { IndexedDbFsClient } from 'git-essentials/clients/fs/IndexedDbFsClient'
import { makeWebHttpClient } from 'git-essentials/clients/http/WebHttpClient'
const fs = new IndexedDbFsClient('my-repos')
const http = makeWebHttpClient({
transformRequestUrl: url => `https://gitcorsproxy.vercel.app/api/cors?url=${encodeURIComponent(url)}`
})
const dir = '/Welcome'
const url = 'https://github.com/NotesHubApp/Welcome.git'
await clone({ fs, http, dir, url })
Check out the CONTRIBUTING
document for more instructions.
This project is based on isomorphic-git library and would not be possible without the pioneering work by @wmhilton and all other amazing members of isomorphic-git community.
This work is released under The MIT License.
FAQs
A collection of essential Git commands for your browser and Node.js
We found that git-essentials demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.