# react-native-file-md5-android

> 本项目为React Native的Android原生模块，用于计算文件的md5值。

Latest version **0.1.0** (published 2016-06-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-file-md5-android
pnpm add react-native-file-md5-android
yarn add react-native-file-md5-android
bun add react-native-file-md5-android
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-06-02 |
| First published | 2016-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | jian |
| Maintainers | j010wdz |
| Keywords | react, react-native, react-component, file, md5, android |

## Links

- npm: https://www.npmjs.com/package/react-native-file-md5-android
- Repository: https://github.com/j010wdz/react-native-file-md5-android
- Homepage: https://github.com/j010wdz/react-native-file-md5-android#readme
- Issues: https://github.com/j010wdz/react-native-file-md5-android/issues
- npm.io page: https://npm.io/package/react-native-file-md5-android

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2016-06-02

## README

# react-native-file-md5-android
本项目为React Native的Android原生模块，用于计算指定文件的md5值。

[![npm version](http://img.shields.io/npm/v/react-native-file-md5-android.svg?style=flat-square)](https://npmjs.org/package/react-native-file-md5-android "View this project on npm")
[![npm downloads](http://img.shields.io/npm/dm/react-native-file-md5-android.svg?style=flat-square)](https://npmjs.org/package/react-native-file-md5-android "View this project on npm")
[![npm licence](http://img.shields.io/npm/l/react-native-file-md5-android.svg?style=flat-square)](https://npmjs.org/package/react-native-file-md5-android "View this project on npm")


使用本模块计算指定文件的md5值

### 安装

```bash
npm install react-native-file-md5-android --save
```

### 添加到你的android项目

* 在 `android/setting.gradle` 文件中添加以下内容

```gradle
...
include ':RNFileMD5Module', ':app'
project(':RNFileMD5Module').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-file-md5-android')
```

* 在 `android/app/build.gradle` 文件中添加如下内容

```gradle
...
dependencies {
    ...
    compile project(':RNFileMD5Module')
}
```

* 注册模块 >= 0.18 (在 MainActivity.java 文件中添加内容)

```java
import com.j010wdz.filemd5.RNFileMD5Package;  // <--- import

public class MainActivity extends ReactActivity {
  ......

  @Override
  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new RNFileMD5Package()); // <------ 添加这行代码到你的MainActivity类
  }

  ......

}
```

* 注册模块 <= 0.17 (在 MainActivity.java 文件中添加内容)

```java
import com.j010wdz.filemd5.RNFileMD5Package;  // <--- import

public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
  ......

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReactRootView = new ReactRootView(this);

    mReactInstanceManager = ReactInstanceManager.builder()
      .setApplication(getApplication())
      .setBundleAssetName("index.android.bundle")
      .setJSMainModuleName("index.android")
      .addPackage(new MainReactPackage())
      .addPackage(new RNFileMD5Package()) // <------ 添加这行代码到你的MainActivity类
      .setUseDeveloperSupport(BuildConfig.DEBUG)
      .setInitialLifecycleState(LifecycleState.RESUMED)
      .build();

    mReactRootView.startReactApplication(mReactInstanceManager, "AndroidRNSample", null);

    setContentView(mReactRootView);
  }

  ......

}
```

## 示例 打开图片选择窗口
```javascript
var FileMD5Android = require('react-native-file-md5-android');

FileMD5Android.getFileMD5(filePath).then((md5)=>{
        alert('文件的MD5值为' + md5);
    }, (code, message)=>{
      //alert(code);
    });
```

## License
MIT

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