Skip to main content
Upload a single file to Private IPFS

Usage

Local Files

If you need to upload files from a local file source you can use fs to feed a file into a blob, then turn that blob into a File.

Returns

Parameters

file

  • Type: File object
Accepts a File object in accordance with the W3C File API.
In most environments you can also pass a Blob here as well.

group (Optional)

  • Type: string
Upload to a specific group by passing in the groupId

keyvalues (Optional)

  • Type: Record<string, string>
Add optional keyvalues to file

name (Optional)

  • Type: string
Add optional name to file

vectorize (Optional)

The file vectors feature is still in beta. Please contact the team at team@pinata.cloud if you have any issues.
  • Type: null
Vectorize a file on upload, requires a group to be used as well.

url (Optional)

  • Type: string
Pass in a presigned upload URL created with createSignedURL

key (Optional)

  • Type: string
Upload a file using a secondary API key generated through keys.create()

expires (Optional)

  • Type: number
Set an expiration date for the file using a Unix timestamp. The timestamp must be in the future. Once the expiration time is reached, the file will be automatically deleted.

waitForCid (Optional)

  • Type: boolean
  • Default: true
Files over 90 MiB are sent with resumable uploads, and Pinata may still be processing the file after its last chunk arrives. By default the SDK waits until the file is registered and returns the full UploadResponse. Pass false to return as soon as the bytes are stored.
With false, only cid and size are set in the response and the other fields are empty. cid is the CID Pinata sent with the last chunk, or an empty string if it wasn’t available yet. Registration can still fail after the method returns.
waitForCid has no effect on files of 90 MiB or less, or when Pinata has already registered the file by the time the last chunk is accepted. It can’t be combined with vectorize(): for files over 90 MiB the method throws a ValidationError before uploading anything.