GithubHelp home page GithubHelp logo

Comments (9)

lavelle avatar lavelle commented on July 30, 2024

Wondering how to handle this. The S3 metadata response doesn't provide the file size either, so instead I download the whole file and check its length. This is very inefficient for big files! Inefficient and incorrect are both bad, but we should at least pick one so its consistent across providers. Which one should we use?

Another option is to return -1 or another invalid value as an error code for backends that don't support efficient retrieval of the size, and only have a valid value present for backends that do provide the size efficiently as a number in the metadata response. I'm inclined to go with this.

Thoughts @jmuk @mtomasz-chromium?

from chromeos-filesystems.

lavelle avatar lavelle commented on July 30, 2024

Or the provider could have a method like hasCorrectSize that the FSP API can call to check if it will be returning a valid size, and use this to determine whether to show the size in the browser.

from chromeos-filesystems.

mtomasz-chromium avatar mtomasz-chromium commented on July 30, 2024

The current file system implementation requires a file size, and bad things may happen if we don't provide it.

Can we get the file size from the Content-Length field using a HEAD HTTP request? That's still inefficient, but at least we wouldn't need to download the entire file. Would it work?

from chromeos-filesystems.

mtomasz-chromium avatar mtomasz-chromium commented on July 30, 2024

According to http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGET.html, AWS S3 does provide the size.

from chromeos-filesystems.

lavelle avatar lavelle commented on July 30, 2024

That would probably work for WebDAV (although might depend on the server implementation). It might be in the AWS raw REST API but I don't think it's in the JS library - the response of headObject doesn't return a size, and that uses HTTP HEAD.

Even if we can get it working for the current two, we should still plan for the eventuality of a provider coming along whose API does not provide an efficient way to get the size of a file, and a way for them to handle it.

from chromeos-filesystems.

mtomasz-chromium avatar mtomasz-chromium commented on July 30, 2024

I'm not sure if I understand. The AWS API returns the size according to the link you provided:
"ContentLength — (Integer) Size of the body in bytes."

from chromeos-filesystems.

mtomasz-chromium avatar mtomasz-chromium commented on July 30, 2024

As for WebDAV, did you consider specifying the "getcontentlength" field in the request? http://msdn.microsoft.com/en-us/library/ms879496(v=exchg.65).aspx

from chromeos-filesystems.

lavelle avatar lavelle commented on July 30, 2024

Huh okay I totally skipped over that property. I guess I was just looking for something called size. I will try working with custom requests for WebDAV. Currently it just fetches the default response (sends no data in the request) but I guess it won't be too hard to customise.

from chromeos-filesystems.

lavelle avatar lavelle commented on July 30, 2024

WebDAV is fixed in #42 and S3 is fixed in #52. Closing.

from chromeos-filesystems.

Related Issues (20)

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.