Socket
Book a DemoInstallSign in
Socket

gift-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gift-wrapper

A Q wrapper for the gift library to perform git operations in node.

1.1.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

gift-wrapper

A Q wrapper for the gift library to perform git operations in node.

Installation

It does not get any easier.

npm install gift-wrapper

API documentation

gift-wrapper API is (almost) exactly same as gift. Only differece is, instead of doing the folowing in gift

someObject.some_method( [arguments], callback );

we will be able to do the following in gift-wrapper

someObject.some_method( [arguments] )
.then( some_callback )
.fail( error_handler )

Here is the link to gift README file for API reference.

Special note about callbacks

There are two forms of callbacks in gift. They are-

  • callback (error, result)
  • callback (result)

However, callback function of form callback(error, result) is not present in gift-wrapper. Instead, the error parameter will be available in error handlers of Q promises (i.e. in fail() method) in appropriate situations. All other callback functions from gift remains same and results are avaialble in immediate then() after the call.

Synchronous execution

Although very rare, but there are few function in gift which executes in a synchronous manner and returns the result of execution directly, rather than via a callback function. This behavior remains the same in gift-wrapper to be consistent with gift.

Example

var gw = require("gift-wrapper");

var repo = gw("/path/to/local/repo");

repo.identity()
.then(function(id){
  console.log(id); // asynchronously getting author information from the repository
  return repo.status();
})
.then(function(status){
  console.log(status); // asynchronously getting status of the repository
})
.fail(console.error); // sending errors to print in stderr, if there is any error

var tree = repo.tree();
console.log(tree); // synchronously getting the tree from the repository

Keywords

q

FAQs

Package last updated on 15 Jan 2016

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.