Преглед изворни кода

Add RNFetchblob.fs.hash function to type definition

vun пре 6 година
родитељ
комит
574febb4a8
1 измењених фајлова са 9 додато и 0 уклоњено
  1. 9
    0
      index.d.ts

+ 9
- 0
index.d.ts Прегледај датотеку

293
     removeCookies(domain?: string): Promise<null>;
293
     removeCookies(domain?: string): Promise<null>;
294
 }
294
 }
295
 
295
 
296
+type HashAlgorithm = "md5" | "sha1" | "sha224" | "sha256" | "sha384" | "sha512";
296
 export interface FS {
297
 export interface FS {
297
     RNFetchBlobSession: RNFetchBlobSession;
298
     RNFetchBlobSession: RNFetchBlobSession;
298
 
299
 
316
 
317
 
317
     ls(path: string): Promise<string[]>;
318
     ls(path: string): Promise<string[]>;
318
 
319
 
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
+
319
     /**
328
     /**
320
      * Create file stream from file at `path`.
329
      * Create file stream from file at `path`.
321
      * @param  path   The file path.
330
      * @param  path   The file path.