> For the complete documentation index, see [llms.txt](https://int-art.gitbook.io/scripty.sol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://int-art.gitbook.io/scripty.sol/building-html/calculating-buffer-size.md).

# Calculating Buffer Size

`ScriptyBuilder` depends on [`DynamicBuffer`](https://github.com/intartnft/scripty.sol/blob/main/contracts/scripty/utils/DynamicBuffer.sol) to assemble fetched scripts.

The main intention of `DynamicBuffer` is to get rid of the repeated usage of `abi.encodePacked` (or similar) when stitching together scripts. To achieve this, **scripty.sol** needs to allocate enough space in memory.

Therefore, you need to know the size of stored scripts before requesting them. Good news is,`ScriptyBuilder` provides methods that you can use to find exact size of stored scripts:

```solidity
getBufferSizeForHTMLInline(WrappedScriptRequest[])
getBufferSizeForHTMLWrapped(InlineScriptRequest[])
getBufferSizeForURLSafeHTMLWrapped(InlineScriptRequest[])

getBufferSizeForEncodedHTMLInline(WrappedScriptRequest[])
getBufferSizeForEncodedHTMLWrapped(InlineScriptRequest[])
```

***These methods are intendend to be used off-chain***

You can check [examples](https://github.com/intartnft/scripty.sol/tree/main/examples) to see how you can fetch the size of stored scripts.&#x20;
