Hi!
I'm extending the Net Panel, following the netListener.js example in
the svn repository.
What i want to do is make a parallel cache of files, and filter which
files i want to cache.
I'm having problems recovering the binary content from the file and
context objects passed to the listeners.
I'm listening to onResponseBody.
The request object inside the file object doen't have any responseText
inside, so I can't dump that file's content to the cache.
Basically, what i'm implementing is:
onResponseBody: function (context, file) {
if (myMimeType == file.mimeType) {
var array = file.request.responseText;
var fileO = Components.classes['@mozilla.org/file/
local;1'].createInstance(Components.interfaces.nsILocalFile);
fileO.initWithPath('/home/user/tmp/file.dat');
fileO.createUnique(fileO.NORMAL_FILE_TYPE, 0666);
var fileStream = Components.classes['@mozilla.org/
network/file-output-stream;1'].createInstance
(Components.interfaces.nsIFileOutputStream);
fileStream.init(fileO, 2, 0x200, false);
var binaryStream = Components.classes
['@mozilla.org/binaryoutputstream;1'].createInstance
(Components.interfaces.nsIBinaryOutputStream);
binaryStream.setOutputStream(fileStream);
binaryStream.writeByteArray(array , array.length);
binaryStream.close();
fileStream.close();
}
}
Thanx!!!
--
You received this message because you are subscribed to the Google Groups
"Firebug" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/firebug?hl=en.