@naria2/options
Advanced tools
Comparing version 0.0.9-beta.0 to 0.0.9-beta.1
@@ -0,2 +1,77 @@ | ||
import { PartialDeep } from 'type-fest'; | ||
import { Aria2ClientInputOptionKey } from 'maria2'; | ||
/** | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#basic-options | ||
*/ | ||
interface Aria2BasicOptions { | ||
/** | ||
* The directory to store the downloaded file. | ||
* | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-d | ||
*/ | ||
dir: string; | ||
/** | ||
* The file name of the log file. If - is specified, log is written to stdout. If empty string("") is specified, or this option is omitted, no log is written to disk at all. | ||
* | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-l | ||
*/ | ||
log: string | undefined; | ||
/** | ||
* Set the maximum number of parallel downloads for every queue item. See also the --split option. | ||
* | ||
* @default 5 | ||
* | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-j | ||
*/ | ||
maxConcurrentDownloads: number; | ||
/** | ||
* Check file integrity by validating piece hashes or a hash of entire file. This option has effect only in BitTorrent, Metalink downloads with checksums or HTTP(S)/FTP downloads with --checksum option. If piece hashes are provided, this option can detect damaged portions of a file and re-download them. If a hash of entire file is provided, hash check is only done when file has been already download. This is determined by file length. If hash check fails, file is re-downloaded from scratch. If both piece hashes and a hash of entire file are provided, only piece hashes are used. | ||
* | ||
* @default false | ||
* | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-V | ||
*/ | ||
checkIntegrity: boolean; | ||
/** | ||
* Continue downloading a partially downloaded file. Use this option to resume a download started by a web browser or another program which downloads files sequentially from the beginning. Currently this option is only applicable to HTTP(S)/FTP downloads. | ||
* | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-c | ||
*/ | ||
continue: boolean; | ||
} | ||
/** | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#http-ftp-sftp-options | ||
*/ | ||
interface Aria2HTTPFTPOptions { | ||
/** | ||
* If true is given, aria2 just checks whether the remote file is available and doesn't download data. This option has effect on HTTP/FTP download. BitTorrent downloads are canceled if true is specified. | ||
* | ||
* @default false | ||
* | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-dry-run | ||
*/ | ||
dryRun: boolean; | ||
} | ||
/** | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#http-specific-options | ||
*/ | ||
interface Aria2HTTPOptions { | ||
} | ||
/** | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#ftp-sftp-specific-options | ||
*/ | ||
interface Aria2FTPOptions { | ||
} | ||
/** | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#bittorrent-metalink-options | ||
*/ | ||
interface Aria2BtMetalinkOptions { | ||
} | ||
/** | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#bittorrent-specific-options | ||
*/ | ||
interface Aria2BtOptions { | ||
} | ||
/** | ||
* Use a proxy server for all protocols. To override a previously defined proxy, use "". You also can override this setting and specify a proxy server for a particular protocol using --http-proxy, --https-proxy and --ftp-proxy options. This affects all downloads. The format of PROXY is [http://][USER:PASSWORD@]HOST[:PORT]. See also ENVIRONMENT section. | ||
@@ -155,22 +230,4 @@ * | ||
}; | ||
interface Aria2BtOptions { | ||
} | ||
interface Aria2FtpOptions { | ||
} | ||
interface Aria2Options { | ||
type Aria2Options = Aria2BasicOptions & { | ||
/** | ||
* The directory to store the downloaded file. | ||
* | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-d | ||
*/ | ||
dir: string; | ||
/** | ||
* If true is given, aria2 just checks whether the remote file is available and doesn't download data. This option has effect on HTTP/FTP download. BitTorrent downloads are canceled if true is specified. | ||
* | ||
* @default false | ||
* | ||
* @link https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-dry-run | ||
*/ | ||
dryRun: boolean; | ||
/** | ||
* Use a proxy server for all protocols. To override a previously defined proxy, use "". You also can override this setting and specify a proxy server for a particular protocol using --http-proxy, --https-proxy and --ftp-proxy options. This affects all downloads. The format of PROXY is [http://][USER:PASSWORD@]HOST[:PORT]. See also ENVIRONMENT section. | ||
@@ -181,6 +238,26 @@ * | ||
proxy: Aria2ProxyOptions; | ||
bt: Aria2BtOptions; | ||
ftp: Aria2FtpOptions; | ||
http: Aria2HTTPFTPOptions & Aria2HTTPOptions; | ||
ftp: Aria2HTTPFTPOptions & Aria2FTPOptions; | ||
bt: Aria2BtMetalinkOptions & Aria2BtOptions; | ||
}; | ||
interface Aria2RPCOptions { | ||
pause: boolean; | ||
pauseMetadata: boolean; | ||
allowOriginAll: boolean; | ||
certificate: string; | ||
listenAll: boolean; | ||
listenPort: number; | ||
maxRequestSize: number; | ||
privateKey: string; | ||
saveUploadMetadata: boolean; | ||
secret: string; | ||
secure: boolean; | ||
} | ||
export { Aria2BtOptions, Aria2FtpOptions, Aria2Options, Aria2ProxyOptions }; | ||
declare function resolveProxyOptions(options?: PartialDeep<Aria2ProxyOptions>): Partial<Record<Aria2ClientInputOptionKey, string>>; | ||
declare function resolveOptions(options: PartialDeep<Aria2Options>): Partial<Record<Aria2ClientInputOptionKey, string>>; | ||
declare function resolveArray<T>(arr: T | T[]): T[]; | ||
declare function isDef<T>(value: T | undefined | null): value is T; | ||
export { Aria2BasicOptions, Aria2BtMetalinkOptions, Aria2BtOptions, Aria2FTPOptions, Aria2HTTPFTPOptions, Aria2HTTPOptions, Aria2Options, Aria2ProxyOptions, Aria2RPCOptions, isDef, resolveArray, resolveOptions, resolveProxyOptions }; |
{ | ||
"name": "@naria2/options", | ||
"version": "0.0.9-beta.0", | ||
"version": "0.0.9-beta.1", | ||
"description": "Shared aria2 options type declerations and utils for naria2", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"dependencies": { | ||
"maria2": "^0.3.0-beta.20", | ||
"maria2": "^0.3.0", | ||
"type-fest": "^3.13.0" | ||
@@ -42,0 +42,0 @@ }, |
@@ -8,4 +8,20 @@ # @naria2/options | ||
## Installation | ||
```bash | ||
npm i @naria2/options | ||
``` | ||
## Usage | ||
```ts | ||
import { resolveOptions } from '@naria2/options' | ||
const aria2Options = resolveOptions({ | ||
// ... | ||
}) | ||
``` | ||
## License | ||
MIT License © 2023 [XLor](https://github.com/yjl9903) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18123
405
27
Updatedmaria2@^0.3.0