UNPKG

@micrio/tiler-base

Version:

The base Micrio client-side tiler package used by the Micrio CLI and GUI tools

34 lines (33 loc) 1.26 kB
import type { FormatType, State, UploadJobType } from '../types.js'; import https from 'https'; /** A session-wide multithreaded uploader to Micrio */ export declare class Uploader { agent: https.Agent; private state; private folder; private format; private outDir; private jobs; private oncomplete; private uris; running: Map<UploadJobType, Promise<any>>; errored: Map<UploadJobType, number>; constructor(agent: https.Agent, state: State, folder: string, format: FormatType, outDir: string); /** This is called for each individual resulting tile of an image operation * Or the final function to send the succesful status to Micrio after all tiles * of an image have been uploaded. */ add(jobs: UploadJobType[]): void; /** Async function to await queue upload completion */ complete(): Promise<void>; /** Get signed R2 upload URLs for the next batch of queued file uploads */ private getUploadUris; /** Get an indivual file/tile uploadUrl */ private getUploadUri; /** This makes sure all upload threads are always filled */ private nextBatch; /** Do the next upload thread */ private next; /** Individual file / tile upload */ private upload; }