rn-fetch-blob
rn-fetch-blob copied to clipboard
create / save file from blob
I am using a library to create a pdf-file locally (pdfmake). The library returns the generated pdf as a blob file. Can I use rn-fetch.blob to create a file from a locally created blob? According to the docs, the supplied fetch-methods can only be used for external urls, and the writeFile method only supports encodings utf8, base64, ascii and uri. I might be mixing things up a litte, but is it possible to create a local file from a locally created blob (in memory)?
@c-goettert you can create a local server to create file by pdfmake on local
pdfmake have a dev-playground dir dev-playground have server.js file
server.js provide api (url=http://localhost:1234/pdf, headers = {'Content-Type': 'application/json'}) your just need to make a form by pdfmake and do post your form to api you can get a base64 base64 have a header before a first comma you need to exclude it then you can decode leftover base64 to get pdf file finially you just need to save file
you need to install package.json
create local server command line example
node dev-playground/server.js
Up!
Same problem here!! I already have a blob that was generated locally and I need to transform to save on the user filesystem!!
Any ideas?
I can not download blob file with RNFetchBlob, eg: blob:https://abc.xxx/75387739-ef58-48eb-b6df-28ca5e4190ad