# stm32dfu

> STM32 DFU DfuSeCommand js

Latest version **0.2.0** (published 2021-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install stm32dfu
pnpm add stm32dfu
yarn add stm32dfu
bun add stm32dfu
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-09-03 |
| First published | 2021-09-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 44.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | KisChang |
| Maintainers | kischang |
| Keywords | STM32, DFU, DFUse |

## Links

- npm: https://www.npmjs.com/package/stm32dfu
- Repository: https://github.com/kisChang/stm32dfu
- Homepage: https://github.com/kisChang/stm32dfu#readme
- Issues: https://github.com/kisChang/stm32dfu/issues
- npm.io page: https://npm.io/package/stm32dfu

## Recent versions

- 0.2.0 (latest) — 2021-09-03
- 0.1.1 — 2021-09-02
- 0.1.0 — 2021-09-02

## README

# stm32dfu.js
A library of host [USB DFU](http://wiki.openmoko.org/wiki/USB_DFU) drivers in Javascript utilizing the [WebUSB](https://wicg.github.io/webusb/) draft standard to implement USB firmware updates from the browser.

Base: <a href="https://github.com/devanlai/webdfu">webdfu</a>

## Used

```bash
npm install stm32dfu
```

```javascript
// init and conn
import stm32dfu from 'stm32dfu'
let deviceSettings = stm32dfu.findAllStm32Device(0x0483)  //修改0x0483为对应的vendorId
stm32dfu.getDfu(deviceSettings[0].device, deviceSettings[0])

// load dfu and flash
let dfuFile = stm32dfu.parseDfuImage([Blob])
let flashSetting = {
  logger : {
    debug: (...data) => {console.log(data)},
    info: (...data) => {console.log(data)},
    warn: (...data) => {console.log(data)},
    error: (...data) => {console.log(data)},
  },
  handler: (done, total) => {
    console.log(`${done} / ${total}`)
  }
}
stm32dfu.flash(deviceSettings[0], dfuFile, flashSetting).then()
```

## TODO

- [ ] demo
- [ ] Rewrite using TypeScript

## Demos
### stm32dfu
https://kischang.github.io/stm32dfu/example/

### dfu-util
A demo re-implementing dfu-util functionality in the browser:

https://devanlai.github.io/webdfu/dfu-util/

---
_Source: https://npm.io/package/stm32dfu · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
