summera / chromestore.js

Simple filesystem API wrapper for Chrome

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getAndWrite method, mime type needed?

paulcanning opened this issue · comments

I found this library today and it looks like it will be a huge help for my chrome app.

However, I am dealing with downloaded several files that are a mix of HTML, JPG, PNG and JS.

The 3rd parameter of getAndWrite is the filetype. Is this a required parameter?

Do you have any suggestions on how to handle multiple file downloads?

hey @paulcanning

filetype is optional and can be an empty string if you don't want to provide it. Although this may prevent the browser from reading the file correctly from persistent storage. You will have to test it out and let me know what you find. It's been a while since I've been in this code.

The simplest thing to do for multiple file downloads would be to call #getAndWrite for every file you want to download. Can you give me more information about your use case?

Also, just an FYI, #write ends up calling #writeData on a FileWriter object which ends up creating a Blob with the information you pass in, such as the optional filetype (https://github.com/summera/chromestore.js/blob/master/chromestore.js#L452).

You can find out more about Blobs from Mozilla and w3c

Hey thanks for the reply.

So is this project no longer in development? Would you still suggest it for current applications?

My use case is that I simply need to download various small files (2mb tops) and store them in subfolders in one main folder.

Currently I am simply looping through an array and calling getAndWrite() multiple times.

Can I use getAndWrite() with jQuerys when() method?

Also, I noticed that I was getting errors when trying to overwrite some files. Some saved, some threw errors. Need to sort out replicating the issue, but something was up!

This project is not being actively developed at this time. filer.js is a project you may want to check out that is more actively developed. Eric Bidelman, who maintains filer.js, is an engineer on Google's Chrome team.

If filer.js fits your use case, I would go with that. If this library works better for you, there's not much code, so it can be adjusted for your needs fairly easily. If you'd like to submit some pull requests, I'd be happy to merge them in as well 😄

$.when is promise based. Both this library and filer.js do not use promises (ebidel/filer.js#5). filesystem.js is promise based, but I haven't looked into it.

I had a look at filer.js and it was OK, but there were some issues/missing
features I wanted.

Wish there was an up to date Chromium Filesystem Library heh :/

On 12 August 2015 at 15:24, Ari Summer notifications@github.com wrote:

This project is not being actively developed at this time. filer.js
https://github.com/ebidel/filer.js/ is a project you may want to check
out that is more actively developed. Eric Bidelman, who maintains filer.js,
is an engineer on Google's Chrome team.

If filer.js fits your use case, I would go with that. If this library
works better for you, there's not much code, so it can be adjusted for your
needs fairly easily. If you'd like to submit some pull requests, I'd be
happy to merge them in as well [image: 😄]

$.when is promise based. Both this library and filer.js do not use
promises (ebidel/filer.js#5 ebidel/filer.js#5).
filesystem.js https://github.com/kklimuk/filesystem.js is promise
based, but I haven't looked into it.


Reply to this email directly or view it on GitHub
#5 (comment)
.

Paul Canning

Web Developer | Photographer