-
Notifications
You must be signed in to change notification settings - Fork 333
zstd-codec support for decompressing files #382
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
787880f
08b5fd6
a4c7c4e
65755ae
34a07ae
9816f3f
e311d62
b4c8df1
8ab6186
fffc0d4
d8a3095
9fd7296
5a5926e
33d942b
9bd2e54
8f7ecce
880ead2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,4 +14,5 @@ CMakeCache.txt | |
| *.clst | ||
| *.snap | ||
| node_modules | ||
| build | ||
| build | ||
| *-lock.json | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| window.ZstdCodec = require('zstd-codec').ZstdCodec; | ||
| require("zstd-codec/lib/module.js").run((binding) => {console.log("running", binding); window.binding = binding} ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,26 +3,24 @@ | |
| "version": "0.1.0", | ||
| "private": true, | ||
| "dependencies": { | ||
| "-": "^0.0.1", | ||
| "@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", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. really need "fs" ? |
||
| "react": "^18.2.0", | ||
| "react-dom": "^18.2.0", | ||
| "react-scripts": "^5.0.1", | ||
| "web-vitals": "^2.1.4" | ||
| "web-vitals": "^2.1.4", | ||
| "zstd-codec": "^0.1.4" | ||
| }, | ||
| "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", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. supposed, need run browserify before react-script |
||
| "eject": "react-scripts eject" | ||
| }, | ||
| "eslintConfig": { | ||
| "extends": [ | ||
| "react-app", | ||
| "react-app/jest" | ||
| ] | ||
| }, | ||
| "browserslist": { | ||
| "production": [ | ||
| ">0.2%", | ||
|
|
@@ -35,5 +33,8 @@ | |
| "last 1 safari version" | ||
| ] | ||
| }, | ||
| "proxy": "http://localhost:5000" | ||
| "devDependencies": { | ||
| "@babel/core": "^7.22.9", | ||
| "babelify": "^10.0.0" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { useEffect, useState } from "react" | ||
| import useDecompress from '../logic/useDecompress' | ||
| import { DATA_SZ, BLK_SZ, PACKET_SZ } from "../helper/sparse"; | ||
|
|
||
| const Decompress = () => { | ||
| const [flashFile, setFlashFile] = useState(); | ||
| const [{ | ||
| requestUSBDevice | ||
| }] = useDecompress(flashFile); | ||
|
|
||
| useEffect(()=> { | ||
| console.log(ZstdCodec) | ||
| console.log(window.binding); | ||
| }, []) | ||
|
|
||
| return ( | ||
| <div> | ||
| file to decompress: | ||
| <input type="file" onChange={(e) => setFlashFile(e.target.files[0])}/> | ||
|
|
||
| <button onClick={requestUSBDevice}>Pair USBDevice </button> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| export default Decompress |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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' | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed commented code |
||
| const root = ReactDOM.createRoot(document.getElementById('root')); | ||
| root.render( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's "-" means here?