dongtanjian9310 2018-07-14 22:03
浏览 50

我可以使用Go SDK 2从AWS S3获取前X个字节吗

I would like to get the first X Bytes from a very large CSV file. I basically just want to get the first two rows so I get the column names and an example of the data in each. However, I know that this isn't going to be possible so I would like to just download enough bytes to reasonably have enough data to be able to look at the first two rows. I am therefore trying to download the first 64kB.

I am trying to do this using the s3 manager ( https://github.com/aws/aws-sdk-go/blob/master/service/s3/s3manager/download.go )

I tried using something like :

downloader := s3manager.NewDownloaderWithClient(svc, func(d *s3manager.Downloader) {
    d.PartSize = 1024 * 64
    d.Concurrency = 1
})

` This hangs though. I'd imagine I am just telling it to download the file with a small part size and it stops there and never returns anything.

Can anybody cleverer than me tell me how I can download just the first X bytes of an S3 file in go? Thanks!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号