Accessing file data after download in Chrome…?

后端 未结 3 516
太阳男子
太阳男子 2020-12-16 06:00

I\'m writing an extension that would ideally read files after they are downloaded (through the normal download process). Is that possible? I can get the filename through chr

3条回答
  •  孤城傲影
    2020-12-16 06:47

    No, the Downloads API does not provide a way to access the file contents.

    The closest for interception would be WebRequest API, but at the moment that doesn't allow response access either.

    The most you can do is to catch a request with webRequest, cancel it and try to XHR it yourself, storing the result in some temporary place like the mentioned FileSystem API. This would be a terrible UX though (the original request fails inexplicably) and may not work in all cases (as XHR can't set all the headers to fully replicate a request).

提交回复
热议问题