You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 :
(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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: