File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,4 +14,5 @@ CMakeCache.txt
1414* .clst
1515* .snap
1616node_modules
17- build
17+ build
18+ * -lock.json
Original file line number Diff line number Diff line change 1+ window . ZstdCodec = require ( 'zstd-codec' ) . ZstdCodec ;
2+ require ( "zstd-codec/lib/module.js" ) . run ( ( binding ) => { console . log ( "running" , binding ) ; window . binding = binding } )
3+ // require("../libwebusb/module.js").run((binding) => {window.binding = binding} )
4+ // require("./node_modules/zstd-codec/lib/module.js").run((binding) => {window.binding = binding} )
5+ // window.binding = "test";
6+ // window.fs = require('fs');
Original file line number Diff line number Diff line change 33 "version" : " 0.1.0" ,
44 "private" : true ,
55 "dependencies" : {
6+ "-" : " ^0.0.1" ,
67 "@testing-library/jest-dom" : " ^5.16.5" ,
78 "@testing-library/react" : " ^13.4.0" ,
89 "@testing-library/user-event" : " ^13.5.0" ,
10+ "fs" : " ^0.0.1-security" ,
11+ "g" : " ^2.0.1" ,
912 "react" : " ^18.2.0" ,
1013 "react-dom" : " ^18.2.0" ,
1114 "react-scripts" : " ^5.0.1" ,
12- "web-vitals" : " ^2.1.4"
15+ "web-vitals" : " ^2.1.4" ,
16+ "zstd-codec" : " ^0.1.4"
1317 },
1418 "scripts" : {
1519 "start" : " react-scripts start" ,
16- "build" : " react-scripts build" ,
20+ "build" : " react-scripts build; browserify index.js -o build/bundle.js -t babelify --presets es2015; " ,
1721 "test" : " react-scripts test" ,
1822 "eject" : " react-scripts eject"
1923 },
20- "eslintConfig" : {
21- "extends" : [
22- " react-app" ,
23- " react-app/jest"
24- ]
25- },
2624 "browserslist" : {
2725 "production" : [
2826 " >0.2%" ,
3533 " last 1 safari version"
3634 ]
3735 },
38- "proxy" : " http://localhost:5000"
36+ "devDependencies" : {
37+ "@babel/core" : " ^7.22.9" ,
38+ "babelify" : " ^10.0.0"
39+ }
3940}
Original file line number Diff line number Diff line change 2525 Learn how to configure a non-root public URL by running `npm run build`.
2626 -->
2727 < title > React App</ title >
28+ < script src ="bundle.js "> </ script >
2829 </ head >
30+
2931 < body >
32+ < h1 > Sample Applications</ h1 >
33+ < div id ="container "> </ div >
34+
35+
3036 < noscript > You need to enable JavaScript to run this app.</ noscript >
3137 < div id ="root "> </ div >
3238 <!--
Original file line number Diff line number Diff line change 11import React , { useState } from 'react' ;
22import Combined from "./components/Combined" ;
3+ import Decompress2 from "./components/Decompress" ;
34import usePopup from "./logic/usePopup" ;
45
56import './App.css'
@@ -12,6 +13,9 @@ const App = () => {
1213 return (
1314 < div className = "App" >
1415 < div className = "u-flex u-column" >
16+ < div >
17+ < Decompress2 />
18+ </ div >
1519 < div className = "u-row" >
1620 < span className = "link-container" > bootloader [optional]: </ span >
1721 < span className = "file-name" > { bootFile ? bootFile . name :"" } </ span >
Original file line number Diff line number Diff line change 1+ import { useEffect , useState } from "react"
2+ import useDecompress from '../logic/useDecompress'
3+ import { DATA_SZ , BLK_SZ , PACKET_SZ } from "../helper/sparse" ;
4+
5+ const Decompress = ( ) => {
6+ const [ flashFile , setFlashFile ] = useState ( ) ;
7+ const [ {
8+ requestUSBDevice,
9+ USBDevice,
10+ preBoot,
11+ send_chunk_headers,
12+ send_packet,
13+ send_flash,
14+ decompressFileToTransform,
15+ } ] = useDecompress ( flashFile ) ;
16+
17+ useEffect ( ( ) => {
18+ console . log ( ZstdCodec )
19+ console . log ( window . binding ) ;
20+ } , [ ] )
21+
22+ return (
23+ < div >
24+ file to decompress:
25+ < input type = "file" onChange = { ( e ) => setFlashFile ( e . target . files [ 0 ] ) } />
26+
27+ < button onClick = { requestUSBDevice } > Pair USBDevice </ button >
28+ </ div >
29+ )
30+ }
31+
32+ export default Decompress
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import ReactDOM from 'react-dom/client';
33import './index.css' ;
44import App from './App' ;
55import reportWebVitals from './reportWebVitals' ;
6+ // import * as Z from 'zstd-codec'
67
78const root = ReactDOM . createRoot ( document . getElementById ( 'root' ) ) ;
89root . render (
You can’t perform that action at this time.
0 commit comments