I have this link/string:
https://link/to/a/file/filename.ext
My JS skills are now rusty and I need to trim the link from the last instance of / so that I could separate the directory and the file name (with the file extension attached to the file name).
var string = 'https://link/to/a/file/filename.ext';
var directory = 'https://link/to/a/file/'; // should have a value of 'https://link/to/a/file' coming from var string
var file = 'filename.ext'; // should have a value of 'filename.ext' coming from var string