I am working on a xul firefox-extension and have a binary value that I want to write to a file using NetUtil.asyncCopy
. I have the data in an array of byte values, and need to convert it into an nsIInputStream
so that asyncCopy can accept it.
I know from mozilla docs that I can convert a string to a nsIInputStream
using
Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
But cannot find any corresponding method to convert an array to an inputstream. Is there an approach that will allow me to do that? (or a different workaround)