Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Error when downloading large SharePoint document using REST API

$
0
0

Hello,

The following code works fine for small files, but I got "SCRIPT14: Not enough storage is available to complete this operation." error when downloading files over 100M.

Is it possible to write the data directly to a local storage (IndexedDB for example) instead of keeping it in memory?

        var getFileEndpoint = String.format(
             "{0}/_api/SP.AppContextSite(@target)/web/getfilebyserverrelativeurl('{1}')/$value?@target='{2}'",
             _SPAppWebUrl, _DocumentUrl, _SPHostUrl);

        var executor = new SP.RequestExecutor(_SPAppWebUrl);
        var info = {
            url: getFileEndpoint,
            method: "GET",
            //binaryStringResponseBody: true,
            success: function (data) {
                //Save data to IndexedDB
            },
            error: function (err) {
                //Error handling
            }
        };
        executor.executeAsync(info);

Since my page is located in a SharePoint Hosted App, I can't use XMLHttpRequest directly to access the document in the host site. Seems like the MS cross-domain library is the only choice to me.

Thanks,

Matt.


Matt





Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>