Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] what is the effect of returning a file or a blob in orion.shell.command?

Since I am following the list anyway...

I don't know what exactly you want to do, but here is a simple use of
a plain text blob to download some text "my contents" to a file:

b = new Blob(["my contents"], {"type": 'text/plain'});

u = URL.createObjectURL(b);

a = document.createElement('a');

a.href = u;

a.download = true;

a.click();

On Tue, Nov 5, 2013 at 8:15 PM, Rafael Chaves <rafael@xxxxxxxxxxxx> wrote:
> Ok, I guess a blob has to be in instance of Blob:
>
> https://developer.mozilla.org/en-US/docs/Web/API/Blob
>
> And this would create a blob from a string:
>
> var myBlob = new Blob(["my contents"]);
>
> And this would be a valid command callback result:
>
> return {file: {path: path + "fileName", isDirectory: false, blob: myBlob}};
>
> Still no dice. No errors, no intended result. Gotta run with the
> non-minified version of Orion in order to debug this one...
>
> On Tue, Nov 5, 2013 at 5:04 PM, Rafael Chaves <rafael@xxxxxxxxxxxx> wrote:
>> Thanks, Grant. I read it then but forgot about that blog post, very helpful.
>>
>> What counts as a blob? I tried returning a JS string but that didn't
>> work. Your post mention an ArrayBuffer but it since I have the
>> contents I need as a simple string I'd rather not have to introduce a
>> dependency on a HTML5 API.
>>
>> Cheers,
>>
>> Rafael
>>
>> On Tue, Nov 5, 2013 at 4:21 PM, Grant Gayed <Grant_Gayed@xxxxxxxxxx> wrote:
>>> Hi Rafael,
>>>
>>> These are demonstrated in
>>> http://planetorion.org/news/2013/02/orion-2-0-whats-new-for-shell-page-plug-ins/
>>> to implement zip and unzip commands from a plug-in.
>>>
>>> I notice that one detail has changed since that blog was posted, GitHub no
>>> longer allows scripts like this to reference its raw content.  A workaround
>>> to get the blog's example working again is to change its two <script
>>> src="..." references from "https://raw.github.com/Stuk..."; to
>>> "https://rawgithub.com/Stuk...";.  I'll be updating the blog with info about
>>> this once WordPress gets around to sending me a replacement for my forgotten
>>> password ;-).
>>>
>>> Grant
>>>
>>> _______________________________________________
>>> orion-dev mailing list
>>> orion-dev@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/orion-dev
>>>
> _______________________________________________
> orion-dev mailing list
> orion-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/orion-dev


Back to the top