Skip to content

Commit

Permalink
Better name
Browse files Browse the repository at this point in the history
  • Loading branch information
JrMasterModelBuilder committed May 4, 2024
1 parent 22a0573 commit dd12899
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bin/download-flash-cn.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {read as packaged} from '../util/packages.mjs';
import {walk} from '../util/util.mjs';
import {queue} from '../util/queue.mjs';
import {download} from '../util/download.mjs';
import {Hasher, Progress, Void} from '../util/stream.mjs';
import {Hasher, Counter, Void} from '../util/stream.mjs';
import {Crc64} from '../util/crc64.mjs';
import {createPackageUrl} from '../util/ia.mjs';

Expand Down Expand Up @@ -57,7 +57,7 @@ async function main() {
await pipeline(
createReadStream(filePath),
hasher,
new Progress(size => {
new Counter(size => {
resource.progress = size / total;
}),
new Void()
Expand Down
4 changes: 2 additions & 2 deletions bin/download-harman-air-runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {createHash} from 'node:crypto';

import {runtimes, userAgent} from '../util/harman.mjs';
import {download} from '../util/download.mjs';
import {Hasher, Progress, Void} from '../util/stream.mjs';
import {Hasher, Counter, Void} from '../util/stream.mjs';
import {queue} from '../util/queue.mjs';
import {createPackageUrl} from '../util/ia.mjs';

Expand Down Expand Up @@ -49,7 +49,7 @@ async function main() {
await pipeline(
createReadStream(filePath),
hasher,
new Progress(size => {
new Counter(size => {
resource.progress = size / total;
}),
new Void()
Expand Down
4 changes: 2 additions & 2 deletions bin/download-harman-air-sdk.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {createHash} from 'node:crypto';

import {sdks, cookies, userAgent} from '../util/harman.mjs';
import {download} from '../util/download.mjs';
import {Hasher, Progress, Void} from '../util/stream.mjs';
import {Hasher, Counter, Void} from '../util/stream.mjs';
import {queue} from '../util/queue.mjs';
import {createPackageUrl} from '../util/ia.mjs';

Expand Down Expand Up @@ -52,7 +52,7 @@ async function main() {
await pipeline(
createReadStream(filePath),
hasher,
new Progress(size => {
new Counter(size => {
resource.progress = size / total;
}),
new Void()
Expand Down
4 changes: 2 additions & 2 deletions util/download.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Readable} from 'node:stream';
import {pipeline} from 'node:stream/promises';

import {retry} from './util.mjs';
import {Progress} from './stream.mjs';
import {Counter} from './stream.mjs';

export async function download(output, url, opts = {}) {
const response = await retry(() =>
Expand All @@ -25,7 +25,7 @@ export async function download(output, url, opts = {}) {
let sized = 0;
await pipeline(
Readable.fromWeb(response.body),
new Progress(size => {
new Counter(size => {
sized = size;
if (opts.progress) {
opts.progress({size, total});
Expand Down
2 changes: 1 addition & 1 deletion util/stream.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class Void extends Writable {
}
}

export class Progress extends Transform {
export class Counter extends Transform {
constructor(progress) {
super();

Expand Down

0 comments on commit dd12899

Please sign in to comment.