Skip to content

Commit d51e9a6

Browse files
authored
chore: remove sync read in unused data extension (#630)
1 parent 460e51c commit d51e9a6

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

Sources/ClientRuntime/PrimitiveTypeExtensions/Data+Extensions.swift

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,7 @@
44
*/
55

66
import struct Foundation.Data
7-
import class Foundation.InputStream
87

98
public typealias Data = Foundation.Data
109

11-
extension Data {
12-
init(reading inputStream: InputStream) throws {
13-
self.init()
14-
inputStream.open()
15-
defer {
16-
inputStream.close()
17-
}
18-
19-
let bufferSize = 1024
20-
let buffer = UnsafeMutablePointer<UInt8>.allocate(capacity: bufferSize)
21-
defer {
22-
buffer.deallocate()
23-
}
24-
while inputStream.hasBytesAvailable {
25-
let read = inputStream.read(buffer, maxLength: bufferSize)
26-
if read < 0 {
27-
throw inputStream.streamError!
28-
} else if read == 0 {
29-
// EOF
30-
break
31-
}
32-
self.append(buffer, count: read)
33-
}
34-
}
35-
}
10+
// Add extensions here as necessary

0 commit comments

Comments
 (0)