Beagle Board - beagleboard.org

BoneScript

readTextFile(filename, [callback])

Read the contents of a text (ASCII) file.

Arguments

  • filename: complete path of the file to be read
  • callback: called upon completion

Return value

  • File contents in a single string

callback(x)

  • x.data: file contents
  • x.err: error status message

Example

var b = require('bonescript');
b.readTextFile('/etc/dogtag', printStatus);
function printStatus(x) {
    console.log('x.data = ' + x.data);
    console.log('x.err = ' + x.err);
}

Build and execute instructions

  • Adjust the file name to read other files and execute the example code.

See also

Related functions

Examples


Last updated by blog.hangerhead.com on Fri Jun 21 2013 14:39:12 GMT-0000 (UTC).
793