3

So question is pretty straight forward. I have an url of a zip file. I need to download it and extract the csv file from it. Values in csv will be saved to an array.

I found this stackoverflow threat but it uses adm-zip, which works with fs package of node, not supported in react-native. Obviously, this solution gave me an error of unknown package "fs". But, i tried to implent the idea of buffering.

So, i used this snippet:

fetch(URL)
        .then((response) => response.arrayBuffer())
        .then((responseBuffer) => {
            //What to do here?
        })

responseBuffer returns an object with bytes size of couple of kbytes. Any help will be appreciated.

Community
  • 1
  • 1
theo
  • 73
  • 1
  • 8

1 Answers1

0

Your best bet is to use one of these zip modules written for React Native -

https://github.com/plrthink/react-native-zip-archive
https://github.com/remobile/react-native-zip
https://github.com/wkh237/react-native-fetch-blob

vinayr
  • 11,026
  • 3
  • 46
  • 42
  • As spotted [https://github.com/wkh237/react-native-fetch-blob/issues/443](here) zipping is out of scope of `react-native-fetch-blob` even in https://github.com/joltup/react-native-fetch-blob there's no zipping capabilities. – Marc_Alx Apr 03 '18 at 08:49