github-tools / github-tools/github

Allow binary blobs

未关闭
#23 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
JavaScript
星标
3.8k
派生
809
PR 合并指标
30 天内没有已合并 PR

描述

In order to safely transfer binary blobs/filtes, the API needs to use base64 encoding when appropriate. postBlob() however always uses "utf-8". So there needs to be either an additional argument in write() and postBlob() that specifies the encoding, or postBlob() needs to detect if the file is binary or not, and adjust the encoding automatically.

This little snippet seems to be able to detect binary data:

```
/[\x00-\x08\x0E-\x1F]/.test(data)
```

See http://stackoverflow.com/questions/1677644/detect-non-printable-characters-in-javascript

I'm currently dealing with similar issues in Prose: https://github.com/prose/prose/pull/255

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。