(cls, path: str, file_hash_info: dict = None)
| 419 | |
| 420 | @classmethod |
| 421 | def from_path(cls, path: str, file_hash_info: dict = None): |
| 422 | file_hash_info = file_hash_info or compute_file_hash(path) |
| 423 | size = file_hash_info['file_size'] |
| 424 | sha = file_hash_info['file_hash'] |
| 425 | with open(path, 'rb') as f: |
| 426 | sample = f.read(512) |
| 427 | |
| 428 | return cls(sha256=sha, size=size, sample=sample) |
| 429 | |
| 430 | @classmethod |
| 431 | def from_bytes(cls, data: bytes, file_hash_info: dict = None): |
no test coverage detected