skynet-js
and skynet-nodejs
. Any file over 40MB will automatically use the built-in tus upload client.skynet-js
may help, but here are some tips./skynet/tus
(i.e. https://siasky.net/skynet/tus)location
header where PATCH requests are made. It should address a specific folder and have an upload identifier like this:https://us-or-1.siasky.net/skynet/tus/1994a347bb0bafd0f92bc4620adb037b9e7b7aa6
location
address mentioned above. The response should have a skynet-skylink
header containing the upload's skylink.const TUS_CHUNK_SIZE = (1 << 22) * 10
Tus-Resumable
header set to the value of 1.0.0
skynet-jwt
cookie set and passed along as credentials with each request to the portal. See Using Your JWT in Server-Hosted Skynet Usage.Chris has written a full desciption of the tus protocol on Skynet, reproduced below.
chunkSize := (4MiB — encryptionOverhead) * fanoutDataPieces.
By default, data uploaded to Skynet uses 10 data pieces for its fanout and Threefish for encryption which doesn’t have any overhead. As a result, the default chunk size is 40MiB. Since portals have limited amounts of RAM, they can’t keep these chunks in memory while waiting for users to resume their uploads. That’s why the chunk size specified in TUS needs to be a multiple of the Skynet chunk size. As long as they match, the portal can upload the chunks and free up memory while waiting for more data.