NewBytesReadCloser
No overview available.
def NewBytesReadCloser(
b: []byte
) - > io.ReadCloser
Creates a new io.ReadCloser from a byte slice. This function is useful when you need to treat an in-memory byte array as a readable and closable stream, for example, when an API expects an io.ReadCloser but your data is already in memory.
Parameters
| Name | Type | Description |
|---|---|---|
| b | []byte | The byte slice to be wrapped as an io.ReadCloser. |
Returns
| Type | Description |
|---|---|
io.ReadCloser | A new io.ReadCloser instance that reads from the provided byte slice. |