getPrice(numBytes)

Returns the cost to upload the specified number of bytes.

Parameters

NameTypeDescription
numBytesnumberThe number of bytes to check the price for

Returns

TypeDescription
BigNumberCost to upload numBytes. Unit is the token specified when instantiating the Irys object. Return value is in atomic units; to convert to standard units use irys.utils.fromAtomic().

Example

Note
Note
Use a token-specific version of getIrysUploader() to connect to an Irys Bundler before uploading.
const irys = await getIrysUploader();

const numBytes = 1048576; // Number of bytes to check
const priceAtomic = await irys.getPrice(numBytes);

// Convert from atomic units to standard units
const priceConverted = irys.utils.fromAtomic(priceAtomic);

console.log(`Uploading ${numBytes} bytes costs ${priceConverted}`);