Java code to the download the file with byte data using box

新規投稿

コメント

4件のコメント

  • cary

    Hey , 

     

    If you are using the Java SDK you can take a look here to see all functions you can perform including upload and download

     

    As far as downloading a file though, this should work:

    BoxFile file = new BoxFile(api, "id");
    BoxFile.Info info = file.getInfo();
    
    FileOutputStream stream = new FileOutputStream(info.getName());
    file.download(stream);
    stream.close();

    However a developer token cannot be refreshed. If you wish to refresh your token I would suggest either JWT or Oauth 2.0, instructions for both can be found here

     

    Before we dive deeper into those, I am curious as to what your use case is? From there we can determine which type of auth is best suited for your needs.

     

    Please let us know, thanks! 

    0
    コメントアクション パーマリンク
  • kalyanch

    Hi Cary,

    To our business requirement, we have huge assets in box to download/upload to another server.

    we do have multi-part upload while we do upload assets in box, do we have any multi-part download option which gives faster response when we do it via box-api and programatically.

    if we don't have multi-download option available, will it leads us to a connectivity issue during huge asset downloading when we do it via box-api? is there way to get status/flag upon downloading assets/failures/success from box ?

     

    Thanks,

    Kalyan.

    0
    コメントアクション パーマリンク
  • cary

    Hey , 

     

    If network connectivity is an potential issue I would recommend taking a look at the `downloadRange()` functions and its overloads in the `BoxFile` class seen here

     

    This function will allow you to download a file's contents while specifying the range in bytes. If anything were to happen you can then start downloading again from that specified range where you left off. This will allow you to download your large content in discrete chunks. 

     

     

    0
    コメントアクション パーマリンク
  • Abdul Rahiman

    When working with bytes data that I want to convert to a string in Python, how do I determine the correct encoding to use for the conversion? Is there a recommended approach or a method to identify the encoding?

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。