"safe-buffer" -- Can this be used/dropped into a Javascript app for a Browser/Extension (Chrome)
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 20/100
- Issue 类型
- 文档
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- javascript, nodejs
- 领域
- web-dev
调研方向
从 issue 中描述的 request_test3.js 和 safe-buffer.js 浏览器 bundle 开始。测试 Chrome 扩展的设置,以确定 Buffer 的初始化方式,以及该 bundle 是否能与 pako 压缩示例配合工作。完成标准是记录一种已确认的浏览器兼容使用路径,或记录其限制。
由索引模型根据 Issue 内容生成。
描述
Update::
In my testing, I've managed to use nodejs/npm/bowserify to create a "safe-buffer.js" that might work in the browser.
However, I don't have a clue (yet) as to how to invoke the "Browser" for my test.
In a normal nodejs kind of script, the following line would be used:
var Buffer = require('safe-buffer').Buffer
I'm not quite sure what my test should have to init a Buffer in my script.
The sample code I'm trying to test is:
As a test, the lines of code I'm trying to test are: (within the request_test3.js
.
const compress = str => Buffer.from(pako.deflateRaw(str)).toString('base64');
console.log(compress('asdfasdfasdfasdf')); //SyxOSUtEwgA=
.
.
Any thoughts??
thanks
Hi.
I'm doing a test app in Chrome/Extension. Dealing with the pako.gzip compression in the Extension, and decompressing on the Server/Php side.
The issues I seem to be running into imply that possible solutions use code which need to have a "polyfil" for the "Buffer".
Given that my skillset with Javascript, is limited, I was wondering if this might work so I can test it out?
<src="safe-buffer.js"> <<< this kind of thing?
thanks
ps.
The test "code" from stackoverflow that I'm referring to is :
//JS
const pako = require('pako');
const compress = str => Buffer.from(pako.deflateRaw(str)).toString('base64');
console.log(compress('asdfasdfasdfasdf')); //SyxOSUtEwgA=
//PHP
function decompress($str) { return gzinflate(base64_decode($str)); }
echo decompress('SyxOSUtEwgA='); //asdfasdfasdfasdf
(the author states)
Note: Buffer instances are also Uint8Array instances, hence we don't need to convert the Buffer to a Uint8Array before giving it to pako.
For JS, this works out of the box in NodeJs. In a browser environment, you will need a polyfil for Buffer.
- 主要语言
- JavaScript
- 星标
- 346
- 派生
- 47
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
feross/safe-buffer 的其他 Issue
-
package.json uses deprecated git:// protocol可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
feross/safe-buffer#43 ·
-
难度 1/5 1 小时以内 新手友好度 52/100
feross/safe-buffer#38 ·
-
难度 2/5 1-3 小时 新手友好度 38/100
feross/safe-buffer#32 · 3 条评论 · 7 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 35/100
feross/safe-buffer#31 ·
-
难度 3/5 1-2 天 新手友好度 42/100
feross/safe-buffer#30 · 10 条评论 · 8 个 reaction ·
查看 feross/safe-buffer 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 80/100
MagicMirrorOrg/MagicMirror#4310 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
bluerobotics/Cockpit-docs#48 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
tc39/proposal-temporal#3332 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
opennextjs/opennextjs-cloudflare#1461 ·
维护者通常 1 天内回复