ファイルのコンテンツをバイナリ形式で返します。
12345
ファイルを表す一意の識別子。
ファイルIDを確認するには、ウェブアプリケーションでファイルにアクセスして、URLからIDをコピーします。たとえば、URLがhttps://*.app.box.com/files/123
の場合、file_id
は123
です。
4
ダウンロードするファイルバージョン
shared_link=[link]
共有リンクを使用して共有されているファイルのURLとパスワード。ユーザーが他の方法でこのファイルにアクセスすることはできません。
shared_link=SHARED_LINK_URL
の形式、またはshared_link=[link]&shared_link_password=[password]
の形式(パスワードが設定されている場合)を使用します。
0-1024
ダウンロードするコンテンツのバイト範囲。
{start_byte}-{end_byte}
の形式を使用して、ダウンロードするファイルのセクションを指定できます。
ファイルをダウンロードする準備ができていない場合は、クライアントがファイルをダウンロードできるようになるまでの秒数を示すRetry-After
ヘッダーが返されます。
この応答は、ダウンロードリクエストの直前にファイルがアップロードされた場合に発生することがあります。
ファイルがダウンロード可能な場合、応答にはdl.boxcloud.com
上のファイルのLocation
ヘッダーが含まれます。
dl.boxcloud.com
というURLは永続的なものではないため、クライアントで実際にファイルをダウンロードするには、リダイレクト指示に従う必要があります。
予期しないクライアントエラー。
curl -X GET https://api.box.com/2.0/files/12345/content \
-H 'Authorization: Bearer <ACCESS_TOKEN>" '
-L
Stream fileContents = await client.FilesManager.DownloadStreamAsync(id: "11111");
BoxFile file = new BoxFile(api, "id");
BoxFile.Info info = file.getInfo();
FileOutputStream stream = new FileOutputStream(info.getName());
file.download(stream);
stream.close();
file_id = '11111'
file_content = client.file(file_id).content()
var fs = require('fs');
client.files.getReadStream('12345', null, function(error, stream) {
if (error) {
// handle error
}
// write the file to disk
var output = fs.createWriteStream('/path/to/file');
stream.pipe(output);
});
let url = FileManager.default.homeDirectoryForCurrentUser
let task: BoxDownloadTask = client.files.download(fileId: "11111", destinationURL: url) { (result: Result<Void, BoxSDKError>) in
guard case .success = result else {
print("Error downloading file")
return
}
print("File downloaded successfully")
}
// To cancel download
if someConditionIsSatisfied {
task.cancel()
}