Client and temp files


Persistent files that we track in your account are called Client Files. These are stored in your File Store Location (typically an S3 bucket) with a corresponding entry in our table with metadata.

A temp file uses a similar process however it's cleared periodically.

Details

You can request the metadata on a Client File using the 'details' endpoint. This does not work for temp files.

Client File details

Response
interface IResponse {
    // The ID of the file.
    ID: string;
    // The file's extension.
    // Should start with a 'dot', we're actively working to ensure this is always the case.
    // It's recommended to either parse it from 'OriginalFileName' or check for the dot yourself until stable.
    FileExt: string;
    // The file's mime type.
    MIMEType: string;
    // The file's original name. This includes the extension.
    OriginalFileName: string;
    // The file's size in bytes.
    OriginalLength: number;
    // The user's ID who uploaded the file.
    "UploadedByUser.ID": string;
    // An optional category for the file.
    // Some Nextspace default purposes have additional meaning.
    Purpose?: string;
    // UTC date/time when the file was uploaded.
    Created: string;
}
Javascript example

Download

To download a Client File from a known ID use this request:

Download Client File

Javascript example

To download a temp file from a known ID use this request:

Download Client File

Javascript example

Delete

To delete a Client File use this request:

Delete Client File

Javascript example

Delete multiple Client Files

Request body
interface IRequest {
    // Array of Client File IDs to delete.
    "Items": string[];
}

Update Purpose

If you'd like to update the purpose of an existing Client File. You can use this request:

Update Client File purpose

Upload file

Smaller file uploads (typically up to 100MB) can be done by sending the file directly in the request body.

Upload Client File

Request body
interface IRequest {
    // The file to upload.
    file: File;
    // Optional purpose to assign to the newly created Client File record.
    Purpose?: string;
}

Upload temp file

Request body
interface IRequest {
    // The file to upload.
    file: File;
}

For larger file uploads, we have to perform a multi-part upload.

You split the file into chunks and upload each part separately. Once all parts are uploaded, your Client File record is created.
The final part you upload to complete your Client File will return the Client File record.

If you experience an issue with a part upload, you can re-upload that part. The system will overwrite the existing portion with the new one.

Upload Client File part

Request body
interface IRequest {
    // Name of the file.
    "originalFileName": string;
    // Unique token to identify this upload.
    // Use a UUID or similar.
    "token": string;
    // Total number of parts you're uploading.
    "count": number;
    // The part number of this upload.
    // This starts at 1.
    "part": number;
    // The file part to upload.
    "file": File;
}

Upload temp file part