Skip to content

Commit c0361b6

Browse files
author
Michael Skelton
committed
Added file helper class
1 parent 95c0f7f commit c0361b6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/helpers/file_helper.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import os
2+
3+
4+
class file_helper(object):
5+
"""description of class"""
6+
def __init__(self, output_file):
7+
self.output_file = output_file
8+
9+
def check_directory(output_directory):
10+
try:
11+
os.stat(output_directory)
12+
except:
13+
os.mkdir(output_directory)
14+
print("[!] %s didn't exist and has been created." % output_directory)
15+
16+
# validate json of output
17+
def is_json(json_file):
18+
try:
19+
with open(json_file, "r") as f:
20+
json_object = json.load(f)
21+
except ValueError:
22+
return False
23+
return True

0 commit comments

Comments
 (0)