#builder error for url Upload plugin

10 messages · Page 1 of 1 (latest)

half fable
#

When I call the download function with the following url I get an error, why ?

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KAAAABHNCSVQICAgIfAhkiAAAAAFzUkdCAK7OHOkAACAASURBVHic7N15vNxVff/x1+c7d83NwuaGARICZGFL7twQ0arYakXFrYpaRetSt9ZqheICJHPmJmyiaEtbl59LrdYqaCuKuKHSVkXIvTeyZYFsLEJA1iQ3ucvM+fz+mEm4d...(shortened)```
solar kettle
half fable
solar kettle
#

not directly, no. You could convert it to actual binary data and use the fs plugin to write the data yourself.

half fable
#

ok thank you, that's not very convenient

half fable
#

I am doing that:

const path = await save({
            filters: [
                {
                    name: 'Images',
                    extensions: ['png'],
                },
            ],
        });
        
const imageBin = dataURLToBin(data);
const file = await create(path || 'drawing.png');
await file.write(imageBin);
await file.close();
solar kettle
#

or well, it takes care of the scope. you still need to enable the file apis themselves

half fable
#

yes but the fs need permission defined beforehand and I don't know where the user will save his file, currently I have an error about permission with the code above.