Skip to content

Commit 574febb

Browse files
committed
Add RNFetchblob.fs.hash function to type definition
1 parent d8c79f6 commit 574febb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ export interface Net {
293293
removeCookies(domain?: string): Promise<null>;
294294
}
295295

296+
type HashAlgorithm = "md5" | "sha1" | "sha224" | "sha256" | "sha384" | "sha512";
296297
export interface FS {
297298
RNFetchBlobSession: RNFetchBlobSession;
298299

@@ -316,6 +317,14 @@ export interface FS {
316317

317318
ls(path: string): Promise<string[]>;
318319

320+
/**
321+
* Read the file from the given path and calculate a cryptographic hash sum over its contents.
322+
*
323+
* @param path Path to the file
324+
* @param algorithm The hash algorithm to use
325+
*/
326+
hash(path: string, algorithm: HashAlgorithm);
327+
319328
/**
320329
* Create file stream from file at `path`.
321330
* @param path The file path.

0 commit comments

Comments
 (0)