douyinmian8151 2015-10-30 06:57
浏览 47

下载时添加暂停和恢复功能

I am using this approach for downloading any file from the given URL. I want to add pause and resume functionality while downloading. I tried to use channels but was not able to succeed.

  • 写回答

1条回答 默认 最新

  • duanjian7343 2015-10-30 07:02
    关注

    You don't really "pause" a download. You can only cancel it. You can do that on an http.Request by doing close(req.Cancel).

    "Resuming" a download is really just making the same request again, but telling the server where to start. Usually by setting a "Range" header.

    This question on superuser explains a bit better how it works usually. You will probably need to provide more details if you want us to help you further.

    评论

报告相同问题?

悬赏问题

  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法