From 3294627a744be77ffcbb0736a3a544f96d24944e Mon Sep 17 00:00:00 2001 From: Jon Pretty Date: Sun, 26 Nov 2023 10:16:10 +0100 Subject: [PATCH] Provide `byteSize` method on `Bytes` --- src/core/bytesize.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/bytesize.scala b/src/core/bytesize.scala index c0d9055..31eb1a4 100644 --- a/src/core/bytesize.scala +++ b/src/core/bytesize.scala @@ -31,3 +31,6 @@ extension (bs: Long) def mb: ByteSize = ByteSize(bs*1024*1024) def gb: ByteSize = ByteSize(bs*1024*1024*1024) def tb: ByteSize = ByteSize(bs*1024*1024*1024*1024) + +extension (bytes: Bytes) + def byteSize: ByteSize = ByteSize(bytes.size)