FwFileSystem
API moderna pra IO de arquivos em TLPP. Replace de File/FOpen/FRead legados, com interface mais limpa.
Assinatura: oFs := FwFileSystem():New() / :readFile() / :writeFile() / :listDir()
Retorna: FwFileSystem
FwFileSystem moderniza IO de arquivos — API estilo Node.js fs, retornando strings/objetos em vez de handles numericos.
Sintaxe
oFs := FwFileSystem():New()
// Ler
cContent := oFs:readFile("/spool/dados.txt")
// Escrever
oFs:writeFile("/export/saida.txt", "linha 1" + CRLF + "linha 2")
// Existencia
If oFs:exists("/spool/arq.xml")
// ...
EndIf
// Listar
aArqs := oFs:listDir("/spool", "*.xml")
For each cArq in aArqs
ConOut(cArq)
End
// Mover/copiar
oFs:copy(cOrig, cDest)
oFs:move(cOrig, cDest)
oFs:delete(cArq)
Pegadinhas
- API mais ergonomica mas mesma performance que FOpen/FRead.
- Caminhos relativos ao rootpath do AppServer.