上传文件
Upload file(s) to MCS using the MCS SDK
upload(fileArray, options)
You can use the upload function to upload an array of file(s) to FilSwan IPFS gateway. The array holds a list of objects, and returns an array of response objects. Using fs
is a simple way to read the file data. The options object is also optional to customize the upload.
Parameters
fileArray: array of objects
fileName: name of file
file: file contents (using
fs
is a simple way to get the file contents)
options: an optional object can also be passed to specify certain parameters:
delay: delay in milliseconds between upload API calls. Default is 1000, but may need to be increased for many larger files
duration: Number of days to store your file on the Filecoin network. (default 525)
fileType: Files of type one will be hidden from the upload list and the UI. NFT metadata files are type 1. (default 0)
Return
This function returns an array of the upload API responses.
Last updated