GithubHelp home page GithubHelp logo

chromestore.js's Issues

Uncaught ReferenceError: Chromestore is not defined

Hi there

I have cloned your repo here and I finally want to use it to write some data into a json file.
unfortunately I cannot initiate chromestore from the beginning.
When I run your chromestore-test it seems to work fine, although I cannot find any files on my harddrive... (are there some created anyway?)

Well I get this error:

Uncaught ReferenceError: Chromestore is not defined 

First I thought I did not load your chromestore.js or i loaded it accidentally before my own js file.
But thats not the case.
I also think I'm waiting long enough to load everything else...
I use this code in my js file:

$(document).ready(function() {

    //initiate chromestore
    var cs = new Chromestore([{
        path: 'export/exportJSON',
        callback: function() {
            console.log('finished creating export folder tree')
        }
    }]);

    //request bytes from filesystem
    cs.init(1024 * 1024, function(cstore) {
        console.log('Chromestore initialized');
    });

    //create file
    cs.getFile('export/exportJSON/fileCreate.txt', {
        create: true,
        exclusive: true
    }, function(fileEntry) {
        console.log('File created');
    });


});

and my html looks like this:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <script type="text/javascript" src="../../03_libs/jquery/jquery-2.1.1.js"></script>
    <script type="text/javascript" src="chromestorejs/chromestore.js"></script>
    <script type="text/javascript" src="csvjson.js"></script>
</head>
<body>


</body>
</html>

Do you have a clue, why chromestore does seem to be there already?
Thanks, help would be very appreciated...

Callback on failure!

Hi @summera

Thankx for the API ๐Ÿ‘

I'm might not know how to use it properly, but if I'm trying to get a file, how can I set a callback if the file does not exist, when the flag create is set to false?

cs.getFile('data/foo.txt', {create: false, exclusive: true}, function (fileEntry) {
        console.log('File created', fileEntry);
});

Cheers,

getAndWrite method, mime type needed?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.