File tree Expand file tree Collapse file tree 3 files changed +55
-1
lines changed
Expand file tree Collapse file tree 3 files changed +55
-1
lines changed Original file line number Diff line number Diff line change 25952595 },
25962596 "writestream" : {
25972597 "cType" : " git_writestream" ,
2598- "needsForwardDeclaration" : false
2598+ "needsForwardDeclaration" : false ,
2599+ "functions" : {
2600+ "git_writestream_write" : {
2601+ "isAsync" : true ,
2602+ "cFunctionName" : " (*(*baton).stream).write" ,
2603+ "args" : {
2604+ "buffer" : {
2605+ "cppClassName" : " Buffer" ,
2606+ "jsClassName" : " Buffer"
2607+ }
2608+ }
2609+ }
2610+ }
25992611 }
26002612 }
26012613}
Original file line number Diff line number Diff line change 259259 "type" : " int"
260260 },
261261 "group" : " stash"
262+ },
263+ "git_writestream_write" : {
264+ "type" : " function" ,
265+ "file" : " types.h" ,
266+ "args" : [
267+ {
268+ "name" : " stream" ,
269+ "type" : " git_writestream *"
270+ },
271+ {
272+ "name" : " buffer" ,
273+ "type" : " const char *"
274+ },
275+ {
276+ "name" : " len" ,
277+ "type" : " size_t"
278+ }
279+ ],
280+ "return" : {
281+ "type" : " int" ,
282+ "isErrorCode" : true
283+ }
262284 }
263285 },
264286 "groups" : [
332354 " git_tree_entry_to_object" ,
333355 " git_tree_entry_type"
334356 ]
357+ ],
358+ [
359+ " writestream" ,
360+ [
361+ " git_writestream_write"
362+ ]
335363 ]
336364 ],
337365 "types" : [
Original file line number Diff line number Diff line change @@ -50,4 +50,18 @@ describe("Blob", function() {
5050 assert . equal ( blob . id ( ) . toString ( ) , oid ) ;
5151 } ) ;
5252 } ) ;
53+
54+ it ( "can create a blob from a Writestream" , function ( ) {
55+ var test = new Buffer ( "test\n" ) ;
56+ var testOid = "9daeafb9864cf43055ae93beb0afd6c7d144bfa4" ;
57+
58+ return NodeGit . Blob . createFromStream ( this . repository , "" )
59+ . then ( function ( stream ) {
60+ stream . write ( test , test . byteLength ) ;
61+ return NodeGit . Blob . createFromstreamCommit ( stream ) ;
62+ } )
63+ . then ( function ( oid ) {
64+ assert . equal ( oid . toString ( ) , testOid ) ;
65+ } ) ;
66+ } ) ;
5367} ) ;
You can’t perform that action at this time.
0 commit comments