Fileオブジェクト研究

Dir.glob(/*.txt/)と同じコードは

new File(".").list(function(n){return null==/.txt/g.exec(n)?false:true})
File.currentDir.list(function(n){return null==/.txt/g.exec(n)?false:true})

ファイルの中身を得る(readAll()は配列でかえってくる模様。標準入力のreadln()と違いきちんとEOFが処理できてる)

js> f=new File("test.txt");f.open("read");f.readAll().join("\n")
test
helloworld

js>