File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 28402840 },
28412841 "writestream" : {
28422842 "cType" : " git_writestream" ,
2843- "needsForwardDeclaration" : false
2843+ "needsForwardDeclaration" : false ,
2844+ "functions" : {
2845+ "git_writestream_write" : {
2846+ "isAsync" : true ,
2847+ "cFunctionName" : " (*(*baton).stream).write" ,
2848+ "args" : {
2849+ "buffer" : {
2850+ "cppClassName" : " Buffer" ,
2851+ "jsClassName" : " Buffer"
2852+ }
2853+ }
2854+ }
2855+ }
28442856 }
28452857 }
28462858}
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" : [
343365 " git_tree_entry_to_object" ,
344366 " git_tree_entry_type"
345367 ]
368+ ],
369+ [
370+ " writestream" ,
371+ [
372+ " git_writestream_write"
373+ ]
346374 ]
347375 ],
348376 "types" : [
Original file line number Diff line number Diff line change @@ -480,4 +480,18 @@ describe("Blob", function() {
480480 } ) ;
481481 } ) ;
482482 } ) ;
483+
484+ it ( "can create a blob from a Writestream" , function ( ) {
485+ var test = new Buffer ( "test\n" ) ;
486+ var testOid = "9daeafb9864cf43055ae93beb0afd6c7d144bfa4" ;
487+
488+ return NodeGit . Blob . createFromStream ( this . repository , "" )
489+ . then ( function ( stream ) {
490+ stream . write ( test , test . byteLength ) ;
491+ return NodeGit . Blob . createFromstreamCommit ( stream ) ;
492+ } )
493+ . then ( function ( oid ) {
494+ assert . equal ( oid . toString ( ) , testOid ) ;
495+ } ) ;
496+ } ) ;
483497} ) ;
You can’t perform that action at this time.
0 commit comments