mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 16:52:53 +08:00
feat(file-md5): add plugin (#4201)
* added cordova-plugin-file-md5 * Update index.ts Co-authored-by: Daniel Sogl <daniel@sogls.de>
This commit is contained in:
parent
032f3a160a
commit
63c83653c0
43
src/@awesome-cordova-plugins/plugins/file-md5/index.ts
Normal file
43
src/@awesome-cordova-plugins/plugins/file-md5/index.ts
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name File MD5
|
||||||
|
* @description
|
||||||
|
* This plugin reads large files in chunks and build the md5sum incrementally.
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { FileMD5 } from '@awesome-cordova-plugins/file-md5/nx';
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* constructor(private fileMD5: FileMD5) { }
|
||||||
|
*
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* this.fileMD5.file(fileEntry)
|
||||||
|
* .then((md5sum: string) => console.log(md5sum))
|
||||||
|
* .catch((error: any) => console.error(error));
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
pluginName: 'FileMD5',
|
||||||
|
plugin: 'cordova-plugin-file-md5',
|
||||||
|
pluginRef: 'md5chksum',
|
||||||
|
repo: 'https://github.com/mramonlopez/cordova-plugin-file-md5',
|
||||||
|
platforms: ['Android', 'iOS'],
|
||||||
|
})
|
||||||
|
@Injectable()
|
||||||
|
export class FileMD5 extends AwesomeCordovaNativePlugin {
|
||||||
|
/**
|
||||||
|
* Get MD5 checksum from a file
|
||||||
|
*
|
||||||
|
* @param fileEntry {FileEntry} File entry is a org.apache.cordova.file.FileEntry
|
||||||
|
* @returns {Promise<any>} Promise with md5sum
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
file(fileEntry: any): Promise<any> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user