- Defined in src/GPUdb.ts:16184
Constructors
Constructors
constructor
Properties
chunkSize
Size above which upload sends a file as a chunked multipart upload instead of in one request.
Matches the JavaScript API’s FileHandler.chunkSize, including its 60 MB default and its writability — callers that set their own threshold, as Cloud Workbench does, keep working unchanged.
- Defined in src/GPUdb.ts:16196
Methods
download
- download(
filenames: string | string[],
options?: Record<string, string>,
callback?: GPUdbCallback,
): Promise<string[]>Downloads files from KIFS and returns their base64-encoded contents.
Parameters
- filenames: string | string[]
KIFS path, or an array of paths
Optionaloptions: Record<string, string>Options for
/download/filesOptionalcallback: GPUdbCallbackOptional callback function
Returns Promise<string[]>
Promise resolving to the base64 contents, in request order
Example
- Defined in src/GPUdb.ts:16525
- filenames: string | string[]
download_and_save
- download_and_save(
filenames: string | string[],
destination: string,
options?: Record<string, string>,
callback?: GPUdbCallback,
): Promise<string[]>Downloads files from KIFS and writes them to a local directory.
Node.js only — a browser cannot write to the filesystem. The directory is created if it does not exist.
Parameters
- filenames: string | string[]
KIFS path, or an array of paths
- destination: string
Local directory to write into
Optionaloptions: Record<string, string>Options for
/download/filesOptionalcallback: GPUdbCallbackOptional callback function
Returns Promise<string[]>
Promise resolving to the paths written
Example
- Defined in src/GPUdb.ts:16566
- filenames: string | string[]
parse_dir_destination
- parse_dir_destination(destination?: string | null): string
Normalises a KIFS directory so it starts and ends with a slash.
Parameters
Optionaldestination: string | nullDirectory path, possibly missing its slashes
Returns string
- Defined in src/GPUdb.ts:16226
parse_flag_to_str
- parse_flag_to_str(
value: string | boolean | null | undefined,
default_value: string,
): stringCoerces a flag to the string form the server expects.
Parameters
- value: string | boolean | null | undefined
Boolean or string flag
- default_value: string
Returned when the value is absent or unusable
Returns string
- Defined in src/GPUdb.ts:16247
- value: string | boolean | null | undefined
parse_options
- parse_options(
incoming_options: Record<string, string> | null | undefined,
endpoint: string,
): Record<string, string>Builds the options for a KIFS call, forcing the encoding this handler transfers in. Caller options are preserved, unlike the JavaScript API, which discards them.
Parameters
- incoming_options: Record<string, string> | null | undefined
Options supplied by the caller
- endpoint: string
’upload’ or ‘download’
Returns Record<string, string>
- Defined in src/GPUdb.ts:16268
- incoming_options: Record<string, string> | null | undefined
upload
- upload(
files: string | Blob | (string | Blob)[],
destination?: string,
options?: Record<string, string>,
progress_callback?: UploadProgressCallback,
callback?: GPUdbCallback,
): Promise<boolean>Uploads files to KIFS.
Accepts local paths (Node.js only) or Blob/File objects (any environment), singly or as an array. Unlike the JavaScript API, file contents are read as binary rather than UTF-8, so images, archives and other non-text files survive the round trip.
Anything larger than chunkSize is sent through upload_multipart rather than in a single request, so a big file does not have to be held in one payload — the same threshold the JavaScript API applied. Everything smaller goes in one batched call.
progress_callbackreports the chunked portion of the work only, as a percentage from 0 to 100. When several files need chunking the percentage spans the whole set rather than restarting per file, so it rises monotonically to 100.Parameters
- files: string | Blob | (string | Blob)[]
Local paths, or Blob/File objects
Optionaldestination: stringKIFS directory; defaults to the root
Optionaloptions: Record<string, string>Options for
/upload/filesOptionalprogress_callback: UploadProgressCallbackPercent complete; chunked uploads only
Optionalcallback: GPUdbCallbackOptional callback function
Returns Promise<boolean>
Promise resolving to true when every file was accepted
Example
- Defined in src/GPUdb.ts:16315
- files: string | Blob | (string | Blob)[]
upload_multipart
- upload_multipart(
file: string | Blob,
destination?: string,
chunk_size?: number,
options?: Record<string, string>,
progress_callback?: UploadProgressCallback,
callback?: GPUdbCallback,
): Promise<string>Uploads one large file to KIFS in chunks.
Initiates a multipart upload, sends each chunk in order, then completes it. If any chunk fails the upload is cancelled server-side before the error is rethrown, so no partial upload is left behind.
Parameters
- file: string | Blob
Blob/File to upload, or a local path under Node.js
Optionaldestination: stringKIFS directory; defaults to the root
- chunk_size: number = …
Bytes per chunk; defaults to 8 MB
Optionaloptions: Record<string, string>Options for
/upload/filesOptionalprogress_callback: UploadProgressCallbackCalled with percent complete after each chunk
Optionalcallback: GPUdbCallbackOptional callback function
Returns Promise<string>
Promise resolving to the multipart upload’s UUID
Example
- Defined in src/GPUdb.ts:16424
- file: string | Blob
Staticextract_filename
- extract_filename(full_path: string, sep?: string): string
Returns the last segment of a path.
Parameters
- full_path: string
Path to take the name from
- sep: string = ’/‘
Separator to split on
Returns string
- Defined in src/GPUdb.ts:16216
- full_path: string
KIFS file access: uploads, downloads, and chunked uploads of large files.
Also reachable as
GPUdb.FileHandler, matching the JavaScript API.