Reputation: 4007
//data = file in []byte
length := len(data)
length
is in type int
. I need to find the length in int64
. I only have the []byte
data of the file. How can I find the size of data in int64
?
Upvotes: 2
Views: 17301
Reputation: 120999
Convert the int
to an int64
:
l := int64(len(data))
The length of a slice is guaranteed to fit in an int
. If the file is larger than what can be represented by an int
, then it's not possible to read the entire file into a []byte.
Upvotes: 8