github-tools / github-tools/github
Write Image to GitRepo
- Lenguaje dominante
- JavaScript
- Estrellas
- 3.8k
- Forks
- 809
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
I am trying to upload an Image to GitHub from the browser. I download the image into a blob, convert the blob into base64 and the use the writeFile method. However, the data never arrives correctly in GitHub.
```JS
fetch(url).then(response => response.blob().then(blob => {
let reader = new FileReader();
reader.onloadend = () => {
var base64result = reader.result.substr(reader.result.indexOf(',') + 1);
let fileName = this.getFileName(image.url)
repository.writeFile(this.github.branch, fileName, base64result, 'Quant-UX Export').then(result => {
resolve(result)
})
}
reader.readAsDataURL(blob);
}))
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Start by tracing the repository.writeFile call in the browser wrapper and compare its handling of the base64result produced by FileReader. Reproduce the image upload with the shown fetch and writeFile sequence; done means the uploaded image arrives correctly in GitHub.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Área
- api
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100