Skip to content

Commit

Permalink
Merge pull request #276 from vunyunt/master
Browse files Browse the repository at this point in the history
Add RNFetchblob.fs.hash function to type definition
  • Loading branch information
Traviskn authored Sep 26, 2019
2 parents eff4ae1 + b48f0e7 commit 6e2234b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ export interface Net {
removeCookies(domain?: string): Promise<null>;
}

type HashAlgorithm = "md5" | "sha1" | "sha224" | "sha256" | "sha384" | "sha512";
export interface FS {
RNFetchBlobSession: RNFetchBlobSession;

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

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

/**
* Read the file from the given path and calculate a cryptographic hash sum over its contents.
*
* @param path Path to the file
* @param algorithm The hash algorithm to use
*/
hash(path: string, algorithm: HashAlgorithm): Promise<string>;

/**
* Create file stream from file at `path`.
* @param path The file path.
Expand Down

0 comments on commit 6e2234b

Please sign in to comment.