FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add Writestream#write by rafaelgieschke · Pull Request #1255 · nodegit/nodegit · GitHub

Repository navigation

Add Writestream#write - #1255

Closed
rafaelgieschke wants to merge 1 commit into
nodegit:masterfrom
rafaelgieschke:writestream
Closed

rafaelgieschke wants to merge 1 commit into
nodegit:masterfrom
rafaelgieschke:writestream

Conversation

Copy link
Copy Markdown
Contributor

#1010 added Blob.createFromStream() but no way to actually use the resulting Writestream.

This pull request adds Writstream#write, so you can create blobs like:

#!/usr/bin/env node

const Git = require("nodegit");

(async () => {
  const repo = await Git.Repository.init("test", 1);
  const stream = await Git.Blob.createFromStream(repo, "");
  const buffer = new Buffer("test\n");
  await stream.write(buffer, buffer.byteLength);
  const buffer2 = new Buffer("test2\n");
  await stream.write(buffer2, buffer2.byteLength);
  const oid = await Git.Blob.createFromstreamCommit(stream);
  console.log(oid);
})();

It does so by declaring a fake git_writestream_write function, matching the write function in struct writestream of libgit2 (https://github.com/libgit2/libgit2/blob/HEAD/include/git2/types.h#L430).

Copy link
Copy Markdown
Collaborator

@rafaelgieschke thanks again. Same as the #1254 with adding tests to ensure functionality.

Copy link
Copy Markdown
Contributor Author

Added a test.

implausible previously approved these changes Nov 28, 2017

Copy link
Copy Markdown
Member

@rafaelgieschke Any chance you can fix the conflicts? I'd like toget this into the codebase.

Copy link
Copy Markdown
Contributor Author

@implausible Thanks for looking at this! I've rebased the PR onto the current master.

zawata commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

please rebase and reopen if still relevant

zawata closed this Nov 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL