Skip to content

Commit

Permalink
Add missing file. (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
floitsch authored Apr 4, 2024
1 parent 962d5a2 commit 79c4488
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/utils_.toit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (C) 2024 Toitware ApS. All rights reserved.
// Use of this source code is governed by an MIT-style license that can be
// found in the LICENSE file.
import io

io-data-to-byte-array_ data/io.Data from/int=0 to/int=data.byte-size -> ByteArray:
if data is ByteArray:
byte-array := data as ByteArray
if from == 0 and to == byte-array.size: return byte-array
return byte-array[from..to]

byte-array := ByteArray (to - from)
data.write-to-byte-array byte-array --at=0 from to
return byte-array

0 comments on commit 79c4488

Please sign in to comment.