Skip to content

Commit

Permalink
[DOC] update usage for file streams
Browse files Browse the repository at this point in the history
  • Loading branch information
DaRealFreak committed Jun 3, 2020
1 parent 64e2e81 commit 93f6265
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,20 @@ python usage.py --dir [--databases] [--minimum-similarity] [--combine-api-types]
you can also use it to get the gathered information for your own script:
```
filtered_results = saucenao.check_file(file_name='test.jpg')
# or with streams/byte objects
filtered_results = saucenao.check_file(io.BytesIO(b'\x00'))
```

or get a generator object for a bulk of files using the worker class, all parameters work here too:
```
from saucenao import Worker
results = Worker(directory='directory', files=('test.jpg', 'test2.jpg')).run()
results = Worker(directory='directory', files=('test.jpg', 'test2.jpg', io.BytesIO(b'\x00'))).run()
```

the worker automatically differentiates between file names and BinaryIO objects,
so you can simply pass both types at the same time.

## Running the tests
In the tests folder you can run each unittest individually.
The test cases should be self-explanatory.
Expand Down

0 comments on commit 93f6265

Please sign in to comment.