Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zstd-codec support for decompressing files #382

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

sarahfwang
Copy link

No description provided.

Copy link
Contributor

@nxpfrankli nxpfrankli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit message is not good enough.
"cleanup 2 at nxp/master" what's 2 means here? "nxp/master" is not necessary. All person only see nxp/master, suggested commit message like

clean up comments code for webusb

Copy link
Contributor

@nxpfrankli nxpfrankli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested commit message:
webusb: add zstd decompress support for wic image

webusb/index.js Outdated
// require("../libwebusb/module.js").run((binding) => {window.binding = binding} )
// require("./node_modules/zstd-codec/lib/module.js").run((binding) => {window.binding = binding} )
// window.binding = "test";
// window.fs = require('fs');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments code

@@ -3,26 +3,24 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"-": "^0.0.1",
"@testing-library/jest-dom": "^5.16.5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's "-" means here?

"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"fs": "^0.0.1-security",
"g": "^2.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really need "fs" ?

},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build": "react-scripts build; browserify index.js -o build/bundle.js -t babelify --presets es2015; ",
"test": "react-scripts test",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supposed, need run browserify before react-script

@@ -3,6 +3,7 @@ import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
// import * as Z from 'zstd-codec'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed commented code


const processChunk = async(data, curr_len, i) => {
console.log(data, curr_len, i);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid log data, it is too big

async function send_packet(raw_data) {
await USBDevice.transferOut(1, raw_data);
console.log("transferout", raw_data);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid log data

if (!flashFile) return;

const file = flashFile;
let buff = await file.arrayBuffer()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed ";"

let totalBytes = 0;

console.log(data)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid log data, which just for debug

return null;
}

console.log("finishing unzipping");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am little confused here, after you decompress whole data, then trigger read. did you check memory usage here. You can stop here to check how many memory used by browser.

@nxpfrankli
Copy link
Contributor

Thanks, I takes some times to merge your patches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants