infinity6i6 Builders Platform
Documentation

Getting started

ingest()

Reference for upload() to send files.

1 min read

Service obtained with sdk.ingest().

upload(params)

js
await sdk.ingest().upload({ dataset, table, partitions, file })
Name Type Required Description
dataset string Yes Dataset that receives the file.
table string Yes Inbox table.
partitions object Yes Values for the table partitions.
file File Yes A single File object.

Returns: a Promise with no value, resolved when the upload succeeds.

Error conditions

  • The promise rejects when file is missing or is not a single File object.
  • The promise rejects when the upload address cannot be obtained.
  • The promise rejects when sending the file fails.

Minimal example

html
<script src="https://cdn.infinity6.ai/releases/sdkweb/latest/bundle/i6sdk-web.js"></script>
<input type="file" id="arquivo" />
<script type="module">
  async function main() {
    const sdk = new window.I6Sdk();
    const user = await sdk.auth().requireUser();
    if (!user) return;

    const input = document.querySelector("#arquivo");
    input.addEventListener("change", async () => {
      const file = input.files[0];
      if (!file) return;
      await sdk.ingest().upload({
        dataset: "<your-dataset>",
        table: "<your-table>",
        partitions: { "<your-key>": "<your-value>" },
        file,
      });
    });
  }
  main();
</script>

Notes

  • The SDK asks the platform for a signed upload address and sends the file to that address with PUT.
  • Each call sends one file.
  • The SDK validates only file. dataset, table and partitions are sent to the platform without local validation.

Guide

First call

Complete page with a file upload.

See guide