Use basename() instead of split('/').pop() and 'wx' flag instead of fs constants for better Windows compatibility.