Skip to content

Commit ed2a240

Browse files
committed
Start documenting and testing js-git public interfaces.
1 parent 7d23427 commit ed2a240

24 files changed

+777
-549
lines changed

Diff for: doc/lib/deflate.md

Whitespace-only changes.

Diff for: doc/lib/inflate-stream.md

Whitespace-only changes.

Diff for: doc/lib/inflate.md

Whitespace-only changes.

Diff for: doc/lib/object-codec.md

Whitespace-only changes.

Diff for: doc/mixins/mem-db.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# mem-db mixin
2+
3+
This mixin implements object store (normal and raw) and stores the data in memory.
4+
5+
```js
6+
var memDb = require('js-git/mixins/mem-db');
7+
var repo = {};
8+
memDb(repo);
9+
repo.saveAs("blob", "Hello World", function (err, hash) {
10+
if (err) throw err;
11+
console.log("Blob saved with hash " + hash);
12+
});
13+
```
14+
15+
This attaches the following interfaces onto the repo object passed in:
16+
17+
- `saveAs(type, body) => hash`
18+
- `loadAs(type, hash) => body`
19+
- `loadRaw(hash) => raw-binary`
20+
- `saveRaw(hash, raw-binary) =>`
21+
22+
All these functions are async and accept either a callback last or return a continuable.
23+
24+
```js
25+
// Example using continuable interface from gen-run generator body.
26+
var commit = yield repo.loadAs("commit", commitHash);
27+
```

Diff for: lib/decoders.js

-104
This file was deleted.

Diff for: lib/deframe.js

-18
This file was deleted.

0 commit comments

Comments
 (0)