Skip to content

Instantly share code, notes, and snippets.

@osima
Created June 5, 2010 22:42
Show Gist options
  • Save osima/427068 to your computer and use it in GitHub Desktop.
Save osima/427068 to your computer and use it in GitHub Desktop.
javascriptでローカルファイルを読む
//
// Rhino を使って JavaScript からローカルファイルを読む.
//
importPackage(java.io);
var filename = "foo.txt";
var br = BufferedReader( InputStreamReader( FileInputStream( filename ) ) );
while( line= br.readLine() ){
if( line==null ){
break ;
}
print( line );
}
br.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment