Skip to content

Instantly share code, notes, and snippets.

@NuckChorris
Created May 11, 2013 09:29
Show Gist options
  • Select an option

  • Save NuckChorris/5559433 to your computer and use it in GitHub Desktop.

Select an option

Save NuckChorris/5559433 to your computer and use it in GitHub Desktop.
var ioService = Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService);
var scriptableStream = Components.classes['@mozilla.org/scriptableinputstream;1'].getService(Components.interfaces.nsIScriptableInputStream);
var input = ioService.newChannel("path/to/file", null, null).open();
scriptableStream.init(input);
var output = scriptableStream.read(input.available());
scriptableStream.close();
input.close();
// Do things with output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment