Socket
Socket
Sign inDemoInstall

@es-git/core

Package Overview
Dependencies
3
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@es-git/core


Version published
Weekly downloads
147
increased by880%
Maintainers
1
Install size
705 kB
Created
Weekly downloads
 

Readme

Source

core

This is part of the ES-Git project.

Install

npm install --save @es-git/core

Usage

This package contains a lot of core functionality used by most of the other es-git packagase. You probably don't need to use this package directly

IRawRepo

This interface is the core of all es-git repositories. New repositories should implement this interface, and mixins should be applied, either directly or indirectly, to this interface.

export interface IRawRepo {
  listRefs() : Promise<string[]>
  getRef(ref : string) : Promise<Hash | undefined>
  setRef(ref : string, hash : Hash | undefined) : Promise<void>
  saveRaw(hash : Hash, object : Uint8Array) : Promise<void>
  loadRaw(hash : Hash) : Promise<Uint8Array | undefined>
  hasObject(hash : Hash) : Promise<boolean>
  saveMetadata(name : string, value : Uint8Array | undefined) : Promise<void>
  loadMetadata(name : string) : Promise<Uint8Array | undefined>
}

export type Hash = string;
listRefs() : Promise<string[]>

Resolves a list of refs (branches and tags). This resolves the full name, for example refs/heads/master or refs/tags/v1.2.3.

getRef(ref : string) : Promise<string | undefined>

Resolves the hash that the ref points to, if it exists. If the ref does not exist, resolves undefined.

setRef(ref : string, hash : Hash | undefined) : Promise<void>

Set the ref to point to a hash. If the hash is undefined, delete the ref. The full name of the ref should be used, for example refs/heads/master or refs/tags/v1.2.3.

saveRaw(hash : Hash, object : Uint8Array) : Promise<void>

Save a git object with the hash.

loadRaw(hash : Hash) : Promise<Uint8Array | undefined>

Load a git object defined by the hash. If the object does not exist, undefined is resolved.

hasObject(hash : Hash) : Promise<boolean>

Resolves to true if the object exists in the repo, otherwise false.

saveMetadata(name : string, value : Uint8Array | undefined) : Promise<void>

Save metadata about the repository. If the value is undefined, the metadata is deleted.

loadMetadata(name : string) : Promise<Uint8Array | undefined>

Load metadata about the repository. If the metadata does not exist, resolves undefined.

FAQs

Last updated on 19 Aug 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc