Skip to content

Commit 6e2234b

Browse files
authored
Merge pull request #276 from vunyunt/master
Add RNFetchblob.fs.hash function to type definition
2 parents eff4ae1 + b48f0e7 commit 6e2234b

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
@@ -294,6 +294,7 @@ export interface Net {
294294
removeCookies(domain?: string): Promise<null>;
295295
}
296296

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

@@ -317,6 +318,14 @@ export interface FS {
317318

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

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

0 commit comments

Comments
 (0)