I started using filesaver.js today.I have created the following function:
function saving(){
    var blob = new Blob(final_transformation, {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello world.txt");
}
but when i call that function i get"Failed to construct 'Blob': The 1st argument provided is either null, or an invalid Array object. " Any ideas?
I was getting the same error.
See the Blob constructor documentation at https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob:
var aBlob = new Blob( array[, options]);
arrayis anArrayofArrayBuffer,ArrayBufferView,Blob,DOMStringobjects, or a mix of any of such objects, that will be put inside theBlob.
So the first parameter to new Blob is pretty specific - it can only be an array that contains objects of several specific types.  A regular string was not working for me, but this works:
> new Blob( [ new TextEncoder().encode( 'some text' ) ], { type: 'text/plain' } )
< Blob {size: 9, type: "text/plain"}
                        Since you won't tell us what final_transformation is, we have to guess with no context. Try this : 
function saving(){
    var blob = new Blob([final_transformation], {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello world.txt");
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With