FunctionalityΒΆ
- The main entry point for our API is the
api.find()method. You can pass in both file/directory paths and the pattern to be searched for. - If you provide a directory path, it will go ahead and do a
os.walkand brings out all the files in that directory path. - While searching for the pattern,
- It avoids all the non-readable files:
- Audio files.
- Video files.
- Image files.
- Some of the kernel based files such as the files under
/procinUbuntu/Linux.
- It reads the file line by line so that we can avoid saving the whole file in the memory (which of course will be memory issue for huge files).
- This whole process runs concurrently. As in, the API allots thread for each file to be searched and once the search is complete, the thread comes and joins back in the main process.
- I personally have tested the performance and the memory usage is very low. If you face any of the performance issues, please report it at Issues.
- The data from the API looks is explained under
Schemasection. The output fields are also explained in the same section. - The output data is a JSON-encoded string and it is generated only when
finderfinds tha pattern in a given file.