Skip to content

Commit dc99116

Browse files
authored
Add example with byte buffer
1 parent c0d716e commit dc99116

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,15 @@ print(translate.from_file('/path/to/spanish', 'es', 'en'))
177177
Using a Buffer
178178
--------------
179179
Note you can also use a Parser and Detector
180-
.from_buffer(string) method to dynamically parser
181-
a string buffer in Python and/or detect its MIME
180+
.from_buffer(string|BufferedIOBase) method to dynamically parser
181+
a string or bytes buffer in Python and/or detect its MIME
182182
type. This is useful if you've already loaded
183183
the content into memory.
184+
```python
185+
string_parsed = parser.from_buffer('Good evening, Dave')
186+
byte_data: bytes = b'B\xc3\xa4ume'
187+
parsed = parser.from_buffer(io.BytesIO(byte_data))
188+
```
184189

185190
Using Client Only Mode
186191
----------------------

0 commit comments

Comments
 (0)