File Upload

Upload files with Story Protocol SDK

Files upload allows users to upload images, metadata and other data onto decentralized file systems. In Story Protocol, the SDK uses Arweave for hosting the uploaded files. Developers can use the uploadFile function in PlatformClient to upload files with SDK.


const { txHash } = await client.platform.uploadFile(file, mimeType);


  • file: File | Buffer: the object represents the file in typescript. For frontend development, we can use the object of File type in Javascript/Typescript. For backend development or pure node, we can use the object of Buffer type.
  • mimeType: string: the media type (also known as a Multipurpose Internet Mail Extensions or MIME type) which indicates the format of the file. You can refer to this link for the full list of MIME types.


Success Response

  • uri: string: the string represent the URI of the uploaded file on Arweave.

Failure Response

The 500 server error will returned when:

  • The uploaded file is too big.


In Node, we can use the following code to upload a local file story.png with uploadFile function:

import { readFileSync } from 'fs';

const file = readFileSync(__dirname + '/story.png');

// Upload file
client.platform.uploadFile(file, 'image/x-png').then(uri => {

By running above example, you will get the following output:

  uri: ''

You can also refer to the full source code of above example at