The only way to interact with the SFTP is Data Extract/File Transfer (and imports).
The problem is that you need both, one after the other is finished.
-> The solution is to put them into an automation, and start that. That takes care of the sequence.
-> The limit to a full programmatic solution is that you cannot create the DataExtractActivity via API, according to docs:
https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.html
(You could create the file transfer, the automation, etc.)
Depending on your usecase you can get around that. Just build one fixed extract by hand, and programmatically change what you put into the DE it extracts.
You can "run once" the automation with SSJS / WSProxy.
For that: Put your required processing into an automation with an empty schedule (which gives it the desired "Ready" state to be run once via API, also known as automation status "2").
Get the objectId (if you use the API to get it, ProgramID) of the automation.
Then write ssjs script that starts / performs / runs once that automation:
https://www.ssjsdocs.xyz/automation-studio/automations/startstop.html
var api = new Script.Util.WSProxy();
var objectID = "S0M3-GU1D-K3Y-G03SR1G4T-H3R3";
var props = {
ObjectID: objectID
};
var action = ["start", "stop"];
var opts = {};
var result = api.performItem("Automation", props, action[1], opts);