Socket
Socket
Sign inDemoInstall

git-object

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

Readme.md~

5

History.md
0.0.2 / 2013-07-30
==================
* Updated documentation
0.0.1 / 2013-07-30

@@ -3,0 +8,0 @@ ==================

2

package.json
{
"name": "git-object",
"version": "0.0.1",
"version": "0.0.2",
"description": "Simple library to retrieve git objects from a repository.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -6,4 +6,63 @@

## License
## Usage
To retrieve a blob from a git repository use the following:
```js
var git = require('git-object');
// retrieve a blob
git('.', 'master', 'index.js', function(err, object){
if (err) return console.log(err); // fail
if (object instanceof git.Blob) {
// create read stream an use it
object.createReadStream().pipe(process.stdout);
} else {
console.log('not a blob');
}
});
```
Reading of a tree is just as simple as this:
```js
// retrieve a tree
git('.', 'master', 'lib/', function(err, object){
if (err) return console.log(err); // fail
if (object instanceof git.Tree) {
object.contents(function(err, contents){
if (err) return done(err);
contents.should.eql([
'git-object.js'
]);
done();
});
} else {
console.log('not a tree');
}
});
```
## API
### Blob
This is the class which is generated by reading a blob.
#### .createReadStream()
Create a stream to the object. This stream is then returned.
### Tree
#### .contents()
Returns the filenames of the tree as array.
## License
(The MIT License)

@@ -30,2 +89,2 @@

TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc