What do you desire as the result? When it is a Nim string, then you could create a new Nim String (newString(size)) of at least the desired size, and fill in the characters. To access the source characters, you may temporary cast your data to a cstring and access the cstring with the [] operator.
But is you want a plain C string with 0 termination -- well that is what we may get from the OS, you should not desire that. Otherwise you may need something like alloc() to allocate untraced memory. If you think copying characters one by one is too slow -- something like low level copyMem() may be possible also, ask again...