Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions cli/unstable_progress_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface ProgressBarOptions {
/**
* The total size expected to receive.
*/
max: number;
max?: number;
/**
* The length that the progress bar should be, in characters.
* @default {50}
Expand Down Expand Up @@ -182,10 +182,11 @@ export class ProgressBar {
*/
constructor(
writable: WritableStream<Uint8Array>,
options: ProgressBarOptions,
options: ProgressBarOptions = {},
) {
const {
value = 0,
max = 1,
barLength = 50,
fillChar = "#",
emptyChar = "-",
Expand All @@ -194,15 +195,15 @@ export class ProgressBar {
keepOpen = true,
} = options;
this.#value = value;
this.#max = options.max;
this.#max = max;
this.#barLength = barLength;
this.#fillChar = fillChar;
this.#emptyChar = emptyChar;
this.#clear = clear;
this.#fmt = fmt;
this.#keepOpen = keepOpen;

this.#unit = getUnit(options.max);
this.#unit = getUnit(max);
this.#rate = UNIT_RATE_MAP.get(this.#unit)!;

const stream = new TextEncoderStream();
Expand Down
Loading