File system abstraction with access management.
API provides common file operations for some folder on AWS s3 drive. Any operations outside of the folder will be blocked. Also, it possible to configure a custom policy for read/write operations.
Can be used as backend for Webix File Manager https://webix.com/filemanager
constwfs=require("wfs-s3");constfs=newwfs.S3("s3://temp-files/some/");//get files in a folderletfiles=awaitfs.list("/subfolder");//get files in a folder and subfolders as plain listletfiles=awaitfs.list("/subfolder",{subFolders: true});//get files in a folder and subfolders as nested structureletfiles=awaitfs.list("/subfolder",{subFolders: true,nested:true});//get folder onlyletfiles=awaitfs.list("/subfolder",{skipFiles: true});//get files that match a maskletfiles=awaitfs.list("/subfolder",{include: a=>/\.(txt|doc)/.test(a)});//ignore some filesletfiles=awaitfs.list("/subfolder",{exclude: a=>a===".git"});//get info about a single fileletinfo=awaitfs.info("some.txt");//check if file existsletcheck=awaitfs.exists("some.txt");//make folderawaitfs.mkdir("sub2");//removeawaitfs.remove("some.txt");//copyawaitfs.copy("some.txt","/sub/");//moveawaitfs.copy("some.txt","some-data.txt");//readletstream=awaitfs.read("some.txt");//writeawaitfs.write("some.txt",stream)// ForceRoot policy is added automatically// readonlyconstwfs=require("wfs-s3");constfs=newwfs.S3("s3://temp-files/some/",newwfs.policies.ReadOnlyPolicy());// customconstfs=newwfs.S3("s3://temp-files/some/",{comply: (path,op)=>{if(op==wfs.Operation.Read)returntrue;// write to temp folder onlyif(file.indexOf("/path/")===0)returntrue;returnfalse;}});//loggingconstwfs=require("wfs-s3");constfs=newwfs.S3("s3://temp-files/some/",null,{verbose: true});MIT