mirror of
https://github.com/jakejarvis/careful-downloader.git
synced 2025-04-28 05:50:27 -04:00
update the types file with new options
This commit is contained in:
parent
a5fade6ddc
commit
5d3410f47f
28
index.d.ts
vendored
28
index.d.ts
vendored
@ -1,4 +1,20 @@
|
|||||||
export interface Options {
|
export interface Options {
|
||||||
|
/**
|
||||||
|
* Absolute URL to a checksums file, usually just a `.txt` containing
|
||||||
|
* filenames and hashes.
|
||||||
|
*
|
||||||
|
* Either this option or `options.checksumHash` is required.
|
||||||
|
*/
|
||||||
|
readonly checksumUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A single hash for the given downloaded file.
|
||||||
|
* e.g. `abcd1234abcd1234abcd1234...`.
|
||||||
|
*
|
||||||
|
* Either this option or `options.checksumUrl` is required.
|
||||||
|
*/
|
||||||
|
readonly checksumHash?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manually set the filename of the download, helpful if the one provided by
|
* Manually set the filename of the download, helpful if the one provided by
|
||||||
* the server doesn't match the filename listed in the checksum file.
|
* the server doesn't match the filename listed in the checksum file.
|
||||||
@ -45,15 +61,15 @@ export interface Options {
|
|||||||
readonly algorithm?: string;
|
readonly algorithm?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell the file stream to read the download as a binary, UTF-8 text file,
|
* Tell the file stream to read the checksums as a string (hex) or binary.
|
||||||
* base64, etc.
|
|
||||||
*
|
*
|
||||||
* @default "binary"
|
* @default "hex"
|
||||||
*/
|
*/
|
||||||
readonly encoding?: BufferEncoding;
|
readonly encoding?: BufferEncoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download a file and validate it with its corresponding checksum file.
|
* Download a file and validate it against a checksum hash. Returns the path to
|
||||||
|
* the validated file or folder (if it's safe).
|
||||||
*/
|
*/
|
||||||
export default function downloader(downloadUrl: string, checksumUrl: string, options: Options): Promise<string>;
|
export default function downloader(downloadUrl: string, options: Options): Promise<string>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user