Comparing version 1.0.2 to 1.0.3
@@ -21,2 +21,4 @@ import fs from "fs-extra"; | ||
return new Promise((resolve, reject) => { | ||
if (this._progress == null) | ||
throw new Error("Progress is not initialized"); | ||
this._progress.on("progress", (progress) => { | ||
@@ -23,0 +25,0 @@ callback(progress.transferred, progress.length); |
@@ -7,3 +7,3 @@ import TurboDownloader from "turbo-downloader"; | ||
private _options?; | ||
_downloader?: typeof TurboDownloader; | ||
private _downloader?; | ||
private _redirectedURL?; | ||
@@ -10,0 +10,0 @@ constructor(_url: string, _savePath: string, _options?: Partial<TurboDownloader.TurboDownloaderOptions> | undefined); |
@@ -29,5 +29,2 @@ import TurboDownloader from "turbo-downloader"; | ||
.head() | ||
.notFound(() => { | ||
throw new Error("Model URL is broken, try to install directly from URL: catai install https://..."); | ||
}) | ||
.res() | ||
@@ -34,0 +31,0 @@ .catch(error => { |
@@ -1,4 +0,4 @@ | ||
export interface IStreamProgress { | ||
init(): Promise<void>; | ||
progress(callback: (progressBytes: number, totalBytes: number) => void): Promise<any>; | ||
export declare abstract class IStreamProgress { | ||
abstract init(): Promise<void>; | ||
abstract progress(callback: (progressBytes: number, totalBytes: number) => void): Promise<any>; | ||
} |
@@ -1,2 +0,3 @@ | ||
export {}; | ||
export class IStreamProgress { | ||
} | ||
//# sourceMappingURL=istream-progress.js.map |
import pullFileCLI from "./download/index.js"; | ||
import CLIPullProgress from "./download/cli-pull-progress.js"; | ||
import { truncateText } from "./utils/truncate-text.js"; | ||
import CopyProgress from "./download/stream-progress/copy-progress.js"; | ||
import FastDownload from "./download/stream-progress/fast-download.js"; | ||
import { IStreamProgress } from "./download/stream-progress/istream-progress.js"; | ||
import { truncateText } from "./utils/truncate-text.js"; | ||
export { pullFileCLI, CLIPullProgress, truncateText }; | ||
export type { IStreamProgress }; | ||
export { pullFileCLI, CLIPullProgress, truncateText, CopyProgress, FastDownload, IStreamProgress }; |
import pullFileCLI from "./download/index.js"; | ||
import CLIPullProgress from "./download/cli-pull-progress.js"; | ||
import { truncateText } from "./utils/truncate-text.js"; | ||
export { pullFileCLI, CLIPullProgress, truncateText }; | ||
import CopyProgress from "./download/stream-progress/copy-progress.js"; | ||
import FastDownload from "./download/stream-progress/fast-download.js"; | ||
import { IStreamProgress } from "./download/stream-progress/istream-progress.js"; | ||
export { pullFileCLI, CLIPullProgress, truncateText, CopyProgress, FastDownload, IStreamProgress }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "ipull", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Super fast cli file downloader", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -87,4 +87,16 @@ <div align="center"> | ||
Example: | ||
```ts | ||
import {FastDownload} from 'ipull'; | ||
const download = new FastDownload('http://example.com/file.txt', './file.txt'); | ||
await download.init(); | ||
const progress = new CLIPullProgress(download, 'file.txt'); | ||
await progress.startPull(); | ||
``` | ||
## Credits | ||
[Turbo-Downloader](https://www.npmjs.com/package/turbo-downloader) - The download engine used in this package |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31189
338
102