github-tools / github

A higher-level wrapper around the Github API. Intended for the browser.
BSD 3-Clause "New" or "Revised" License
3.56k stars 754 forks source link

Update Repository.js to works with png #649

Open wdison opened 3 years ago

wdison commented 3 years ago

Using the raw parameter within the options of the writeFile method, this tool works with the sending of png images, it has not been tested with other files, but I think this solution will work for others as well.

  writePng(fileNamePng:string,base64Png:any,commitMsg:string=''){
    let initialMessage=commitMsg||'Commit de '+base64Png;
    let option = {encode:false,raw:true}
    const promise = this.bagRepo.writeFile('master', fileNamePng, base64Png, initialMessage, option);
    promise.then((valor:any) => {
      // console.log(valor);
    },this.initRepo);
    return promise;
  }
wdison commented 3 years ago

Dear @j-rewerts and other merge makers, I hope you're all right.

This change is small very simple, but it brings a lot of gain to the api, it has compatibility with any other preexisting call to this method, and it is very useful for other users.

Please consider this for merging.

GETBACKGANG commented 3 years ago

Replying to recent gmail I received from you

GETBACKGANG commented 3 years ago

Thank you

On Thu, Jun 3, 2021, 10:05 AM Jose Wdison de Souza @.***> wrote:

Dear @j-rewerts https://github.com/j-rewerts and other merge makers, I hope you're all right.

This change is small very simple, but it brings a lot of gain to the api, it has compatibility with any other preexisting call to this method, and it is very useful for other users.

Please consider this for merging.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/github-tools/github/pull/649#issuecomment-853940604, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUKT5KUE5DTFEAT3JNBWFYTTQ6KZ3ANCNFSM42ZZKR7A .